Results 1 to 6 of 6

Thread: Formatting cells in a grid

  1. #1

    Default Formatting cells in a grid

    How would I reformat cells in a grid

    Code:
    Column1       Column2   Column3
    AmountText  12.411     14.156
    QtyText        5.2         1.25255
    to

    Code:
    Column1             Column2   Column3
    AmountText        $12.41     $14.15
    QtyText             5             1

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    By using a renderer in the Column definition.

    Read about defining columns: http://extjs.com/deploy/dev/docs/?cl...id.ColumnModel

  3. #3

    Default

    The column model does column formatting, not row formatting, right?
    I want to do row formatting, well not quite. I want to do cell formatting based on a row.

    Row 1, columns 2 and 3 has to be dollar formatted ($5.50).
    Row 2, columns 2 and 3 has to be number formatted with no decimals (5).

    I was looking at the GridView -> getRow( Number index ) : HtmlElement but I can't figure it out.

  4. #4
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    The renderer passes in a bunch of information about the current record/row/column. Have a look at the docs for renderer to see all the info passed.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  5. #5

    Default

    Thanks guys for your help and patience.
    I should have printed off the FAQ and read through that first.
    HTML Code:
    http://extjs.com/learn/Ext_FAQ_Grid#Links_inside_grid_cells
    I seem to get so confused trying to sort through the API.
    I guess it's just a matter of getting used to all of the objects and methods.

    I looked at the GridPanel and GridView objects carefully but I didn't
    even think to look at the column object...

    Side note: Is there a way to print the API?

    Thanks again!

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    It can be quite daunting at first because of the richness of the API.

    But it is split into packages quite logically.

    For Grid stuff, concentrate on the Ext.grid folder of the API docs tree.

    Also, when scanning a class's API page, use the "Hide inherited members" button to remove stuff it inherits.

    So removing from GridPanel, everything it inherits from Panel will clear things up for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •