PDA

View Full Version : GridPanel renderTo property



balaji1_1
16 Sep 2010, 6:32 AM
Hello,
Im using the Ext.grid.gridPanel() object to render a datagrid in a javascript page. The "renderTo" property displays the details of the grid to apppropriate 'id' specified. However I would like to have a check if the id is present in the page or not.

So instead of having the original code:


var grid = new Ext.grid.EditorGridPanel({
renderTo: 'grid1'
})

I would like to have a check in the renderTo property :


var grid = new Ext.grid.EditorGridPanel({
renderTo: function(){
if(tab.id('grid1') exists) then return grid1 else return ' ';
}
})

The reason for this check is IN IE8,Mozilla with firebug enabled, there is a warning/error that is displayed for missing ID's.

Is this possible to be executed in EXTJS?

teamhonda81
16 Sep 2010, 6:46 AM
Balaji,

This may or may not work, but what if you removed the renderTo from your configuration and then did a check for the id, and if the id exists, then call the grids render method

Example:


var grid = new Ext.grid.EditorGridPanel({
/* Set config properties */
});
if (Ext.get('someID')) {
grid.render('someID');
}


Hope this points you in the right direction.