PDA

View Full Version : ColumnModel of Grid



udayogra
2 Nov 2012, 3:57 AM
1. In previous versions grid used to have 'columnmodel' which does not exist now.
That model used to have these methods colModel.getCellEditor,colModel.getDataIndex(i)


What are the alternative methods now? For dataindex I used grid.columns[i].dataIndex, is it the right way?


2. We also used to use Records a lot like this :



grid.getStore().add(new Ext.data.Record(insertData))


where insertData would be key value pairs of column name and corresponding values.
But this doesnt work now. Do I need to use 'Model instead? Is the syntax same?'

Farish
2 Nov 2012, 4:46 AM
Not sure what you want to get in your first question. may be the getPlugin() method of the grid is what you are looking for? You can access the columns array using grid.columns.

For (2), you have to add model instances to your store. you can find an example in the API Docs:


store.add({some: 'data'}, {some: 'other data'});

So yes, its a key:value pair (you can add more than one). If you have your data in an array, you can use store.loadData(dataArray);

I would recommend taking a look at the API Docs (http://docs.sencha.com/ext-js/4-1/#!/api/). that will surely answer a lot of questions.