ExtJS: grids data linking -
i have 2 ext.panel.grid (let's call "a" , "b") when select line in grid "a", data loads grid "b. main problem grid "b" editable, , when select record in "a", changes in "b" record lost :(
there next logic in controller
"grid id[a]": { selectionchange: function(grid, record) { this.getgridb.getstore().loaddata( record.get('options'), false ); } }
and sample record is:
{ name: "item1", owner: "user1", options: [ { value: "345", name: "option1" }, { value: "100500", name: "option2" } ] }
where should store changed values? or there another, more "straight" solution?
loaddata() loads array of data straight store.if data in correct format respect model of other store can use method directly loading model object. if wish add data existing records in store,you have set append true default false.
store.loaddata(data, true);
where data : ext.data.model[]/object[]
so should :
listeners: { selectionchange: function(thisobj, selected, eopts) { gridb = ext.getcmp('grida'); gridb.getstore().loaddata(selected, true);//true append records gridb.getview().refresh(); } },
Comments
Post a Comment