PDA

View Full Version : HOW TO USE THE VALUE OF GRID IN DIFFERENT FILE



sachin sachdeva
10 Jan 2011, 6:05 AM
HELLO SIR

I have 2 files named MAIN.JS AND ASSET.js Now my problem is i have a grid in assest js as shown in code below i want to use the value of that grid in main.js my code will elaborate the problem...

ASSET.JS

var grid = new Ext.grid.GridPanel({
el : 'document-grid',
id : 'document-grid',
height : mainTabPanel.getSize().height - 27,
loadMask : {
hideOnReady : false
},
viewConfig : {
forceFit : true
},
ds : dataStore,
cm : columnModel,
sm : sm,
bbar : bar,
ddGroup : 'GridDD',
enableDragDrop : true
});
grid.render();
grid.on('rowclick', updateProps);
function updateProps(grid, dataIndex) {
var dataRow = grid.getSelectionModel().getSelected();
alert(dataRow .data.id) //-----NEED THIS ROW VALUE IN MAIN .JS-------//PLZ SEE THE CODE BELW
}

MAIN.JS
{

bbar : new Ext.Toolbar({
buttonAlign : 'center',
items : [new Ext.Button({
text : 'Save',
scale : 'small',
style : {
border : 'solid 1px gray'
},
handler : function() {.........}
Ext.Ajax.request({
url : 'updateMetadata.jsp',
method : "POST",
params : {
//----NEED TO SEND THAT VALUE HERE-----//
},









}
plz tell me how to send that value in main .js

11 Jan 2011, 1:18 PM
please do not duplicate post!

Since you have things in many places, use Ext.getCmp, even though it's not the best for your application.