PDA

View Full Version : Error-->Dom.frstChild is null or not an object [Solved]



pravin_bluebird
14 Sep 2007, 3:34 AM
Hello frends,

When i click on any tree node i call one function which shows grid in a center region.
Now when next time any node is clicked its show error in IE6

dom.frstChild is null or not an object

Any idea whats the reason?.......

Regards

pravin_bluebird
15 Sep 2007, 12:56 AM
Any Help?..................

Animal
15 Sep 2007, 5:09 AM
Use ext-all-debug.js

Install Visual Studio, and debug it.

You could show us your code to see if we can see any mistakes in it, but apart from that, how can we be expected to know what is happening inside your application?

pravin_bluebird
3 Oct 2007, 4:04 AM
my application work like this
when i click on any tree node i just call a function to create a grid.
Next time when i click on any other node it gives me Dom.firstChild is null or not an Object error

My purpose is i just want to load grid data depending on tree node

here is my code



var treePanelOnClick = function(node){
createGrid(node);
}


function createGrid(node)
{

Ext.get('center').dom.innerHTML = '';

Ext.get('center').dom.innerHTML = '<div id="asset-grid" style="border:0px solid #99bbe8;overflow: hidden; width: 100%;

height: 230px; "> </div>';


AssetDS = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'asset_data.php?node_id=node}),
reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'totalCount',
asset_id: 'asset_id'

},
[
{name: 'Asset_id', mapping: 'asset_id', type: 'int'},
{name: 'Asset_name', mapping: 'asset_name', type: 'string'},
{name: 'Description', mapping: 'description', type: 'string'},
{name: 'Asset_analysis_class', mapping: 'asset_analysis_class', type: 'string'}

]),
// turn on remote sorting
remoteSort: true
});

AssetDS.setDefaultSort('Asset_id', 'asc');
var cm = new Ext.grid.ColumnModel([
{header: "Asset Id", dataIndex: 'Asset_id', width: 70, sortable: true, align: 'right',editable: false},
{header: "Name", dataIndex: 'Asset_name', width: 100, sortable: true },
{header: "Description", dataIndex: 'Description', width: 200, sortable: true},
{header: "Analysis class", dataIndex: 'Asset_analysis_class', width: 50, sortable: true}

]);
cm.defaultSortable = true;
grid = new Ext.grid.EditorGrid('asset-grid', {
ds: AssetDS,
cm: cm,
selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
enableColLock:false,
loadMask:true

});

// some code for grid head
.
.
.
.

// some code for grid footer


} // create grid Ends here

regards

fay
3 Oct 2007, 4:25 AM
Why are you creating the grid every time a node is clicked? This is what will cause your problem - you'll see this if you debug with FireFox/FireBug. You just need to create the grid once, and then change the params for load() depending on the selected node. Something like:


AssetDS.load({params: {node_id: node}});

architect
3 Oct 2007, 5:26 AM
Check also this thread (http://extjs.com/forum/showthread.php?t=13491)