PDA

View Full Version : Load one grid contents from another grid



wasima
15 Mar 2012, 9:09 AM
I have two grids...grid1 and grid2 , when i click on a row of grid1 then contents of grid2 are loaded..My grid1 store and model is
grid1 model : Ext.define ('fv.model.QfNodeFru', { extend: 'Ext.data.Model'
,fields: ['id', 'name','fruType','serialNum','partNum','manufacturer', 'installedOn']
});

Store of grid 1 is : Ext.define('fv.store.Inventory.NodeFruGridStore', {
/* extends class Ext.data.Store */
extend : 'Ext.data.Store'
,model : 'fv.model.QfNodeFru'
,autoLoad: true
,proxy : {
type: 'ajax'
/* data retreived from inventory servlet */
,api : {
read: 'InventoryServlet'
}
, extraParams : {
inventoryclass : 'QfNodeFru'
, id : '1'
}




/* reader type json */
,reader : {
type: 'json'
}
}
});

in grid1 i have a listener like this :


,listeners: {


itemclick : function() {


var data = grid.getSelectionModel().selected.items[0].data;
alert ('data'+data.id);
// grid_product.setTitle(data.name + ' Products List');


nodePortStore.clearFilter();


nodePortStore.filter('fruId', data.id);


nodePortStore.load();


}


}

grid2 model is Ext.define ('fv.model.QfNodePort', { extend: 'Ext.data.Model'
,fields: [ 'fruId','name','portType','linkStatus','portStatus','lastFlapped']
});

grid2 store is : Ext.define('fv.store.Inventory.NodePortGridStore', {
/* extends class Ext.data.Store */
extend : 'Ext.data.Store'
,model : 'fv.model.QfNodePort'
,autoLoad: true
,proxy : {
type: 'ajax'
/* data retreived from inventory servlet */
,api : {
read: 'InventoryServlet'
}
, extraParams : {
inventoryclass :'QfNodePort'
, id :''
}




/* reader type json */
,reader : {
type: 'json'
}
}
});

i am not able to load contents of grid2 when i click on row of grid1...i get a loading mask but no data is rendered in grid2...please note that in grid2 store the id is a parameter to be passed to a servlet to fetch data ....that value has to be taken from the id of a row in first grid ......can u help me..?

mitchellsimoens
15 Mar 2012, 11:00 AM
Is the request being sent off? Is the response valid? Does the 2nd store have data?