PDA

View Full Version : Problems with binding "id" in EditorGrid - ext-1.0-alpha3



BorodaAlex
5 Apr 2007, 5:15 AM
I am a beginner in Ext JS . Sorry for my bad English.

Data for the EditorGrid I receive from a array:
var myData = null;
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(myData),
reader: new Ext.data.ArrayReader({id: 'id'},
[
{name: 'imageName', type: 'string'},
{name: 'tag', type: 'string'},
{name: 'description', type: 'string'}
])
});
ds.load();

( The grid is empty at creation - I load data after):

show : function(data)
{
var formattedData = this.formatData(data);
var dataStore = this.grid.getDataSource();
dataStore.loadData(formattedData, false);
},

formatData : function(data)
{
var lenSelectedImages = data.names.length;
formatedImagesInfo = new Array(lenSelectedImages);
for (var i=0; i < lenSelectedImages; i++)
{
formatedImagesInfo[i] = new Array(3)
for (var j=0; j < 3; j++)
{
if (j==0)
formatedImagesInfo[i][j] = data.names[i]
else formatedImagesInfo[i][j]='';
}
}
return formatedImagesInfo;
},

How i should set up the Store that the identifier automatically increased for every row?

It is necessary for me, that at allocation of row i can address to them on ID.
Then I wish to change value in cells of the chosen rows and update the grid with new data.

var selected = this.grid.getSelections();
selected.data[i].id - Whether is possible so to make ?


-------------
Help me to construct this mechanism please.