Danilo M.
Danilo M.

Reputation: 1592

How to display the line count on a grid in ExtJs?

I am developing an ExtJs application; and in this application it is possible to add new lines dynamically to a grid. However, I do not know how I can number the lines as they are added. Can anyone provide me with some insight?

Upvotes: 0

Views: 1406

Answers (1)

Ben
Ben

Reputation: 1368

Check the RowNumberer class in the documentation.

columns: [
    {xtype: 'rownumberer'},
    {text: "Company", flex: 1, sortable: true, dataIndex: 'company'},
    {text: "Price", width: 120, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
    {text: "Change", width: 120, sortable: true, dataIndex: 'change'},
    {text: "% Change", width: 120, sortable: true, dataIndex: 'pctChange'},
    {text: "Last Updated", width: 120, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
]

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.RowNumberer

Upvotes: 1

Related Questions