sachin sachdeva
10 Jan 2011, 11:09 PM
hello sir...

I have two files named as Main.js and revision.js...Now issue is i have a grid defined in revision .js as shown in code below

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.on('rowclick', updateProps);
function updateProps(grid, dataIndex) {
var dataRow = grid.getSelectionModel().getSelected();
alert(dataRow .data.author) //---here i am getting author but i need this auhtor in main.js plz look into code }


items : [
GeneralpropsGrid = new Ext.grid.PropertyGrid(
title : 'General Properties',
isEditable : true,
loadMask : {
hideOnReady : false

source : {
// "name" : "value",
// "name2" : "value2"
bbar : new Ext.Toolbar({
buttonAlign : 'center',
items : [new Ext.Button({
text : 'Save',
scale : 'small',
style : {
border : 'solid 1px gray'
handler : function() {

//I need that author value here so that i can send that author to server side using the ajax request
url : 'updateMetadata.jsp',
method : "POST",
params : {
//----------AUTHOR REQUIRED--------//


please tell me how can i get the value of grid in different file.....

11 Jan 2011, 1:11 AM
var author = Ext.getCmp('document-grid').getSelectionModel().getSelected().get('author');

sachin sachdeva
11 Jan 2011, 3:50 AM
No sir it's not working it is throwing an error (Ext.getCmp('document-grid') is undefined)..........

11 Jan 2011, 4:14 AM
Are you sure the grid is already created at that point?

sachin sachdeva
12 Jan 2011, 3:15 AM
sir i am using a function to create a grid the code for that function is...

function assetRevisionDetails(grid, rowIndex, columnIndex, e) {

var recordtoedit = grid.getSelectionModel().getSelected();
var contentId = recordtoedit.get("id");
var panelContent;

panelContent = new Ext.Panel({
enableTab : true,
region : 'center',
id : 'rTabPanel',
margins : '0 0 0 0',
autoScroll : false,
closable : true,
enableTabScroll : true,
allowDomMove : true,
title : 'Asset-Revision',
html : '<iframe style="width:100%;height:100%" frameborder = "0" src="revisionDetails.jsp?contentId='
+ contentId + '"></iframe>'



inside that we have a i frame where we are redering our grid so think the path that you have given is not right i have tried Ext.getCmp("rTabPanel") which works fine but i dont know from here how can i reach to that grid plz help me

13 Jan 2011, 12:15 AM
OK, so the grid is in a different frame! That is something I would really recommend against.

I know it's a big rewrite, but I would only use a single HTML page and concatenate, minify and gzip all my javascript into a single file that is loaded upfront.
Next, you only exchange data with your server (have your .jsp pages only return JSON data with Content-type:application/json).

13 Jan 2011, 3:02 AM
That's a good point Condor but I am not sure how I would achieve this. I have a web application that I am gradually introducing ExtJS to. The complication is that the layout of forms, read only fields etc changes on a user by user basis. How would you suggest handling such a scenario?

13 Jan 2011, 5:14 AM
You could add the fields dynamically to the form or hide them when they are not allowed.