PDA

View Full Version : adding items dymanicaaly into store



barbara1712
31 Jan 2010, 10:56 PM
Hi,

I am using itemselector and grid panel.
I drag the items from fromStore to toStore. works perfect.
Also there is one button clicking on which a grid panel gets opened in popup.
What I want is , I select the items from the grid (using checkboxselectionmodel) and when I click on 'Save' button, the selected items should get added in the toStore.

Please help, how to achieve this.

Thanks.

nicobarten
1 Feb 2010, 12:16 AM
store.add(records[]); ?

barbara1712
1 Feb 2010, 12:34 AM
thanks nicobarten.

But can you give me example.
The code I am using is



var KRAReader = new Ext.data.JsonReader({
root: 'records', // Containd the Records
totalProperty: 'totalCount' // Contains no. of Records
},
[
{name: 'id',mapping:'id'},
{name:'weightage',mapping:'weightage',type:'float'},
{name: 'name',mapping:'name'},
{name:'flag',mapping:'flag',type:'int'}
]);

stAllKRA = new Ext.data.Store({
remoteSort: true,
proxy: new Ext.data.HttpProxy({
url: 'getdata.php',
method: 'POST'
}),
reader: KRAReader,
listeners:{beforeload:function(){
this.baseParams={
desig : desig
}
}}
});


This store already have data in it.
I want to add records checked in the grid panel.

How can I use the add method