PDA

View Full Version : Issue populating Grid Panel



KedarP
11 Sep 2013, 5:26 AM
Hi,

Would really appreciate help on this issue..

We are using a GridPanel inside FormPanel and binding it to an arraystore. The data gets bound and displays correctly. However everytime the gird populates it throws the error below and the row selection gives null data.(Attached a notepad file that contians more elaborate code) Unable to get value of the property 'stopEditing': object is null or undefined

Below is the sequence of code that we have used...
1) Define a global grid variable--
var grd_Overview_JobsReadyForImport;
2) Reader
var JobsReadyForImport = new Ext.data.ArrayReader({}, [
{ name: 'jobname' },
{ name: 'language' },
{ name: 'projectid' },
{ name: 'projectname' },
{ name: 'action' }
]);
3) In the constructor populate the grid by setting the store

grd_Overview_JobsReadyForImport.store = new Ext.data.Store({
reader: JobsReadyForImport,
data: allProjectsObj
});
4) Grid definition

grd_Overview_JobsReadyForImport = new xg.GridPanel({
id: 'grd_Overview_JobsReadyForImport',
store: new Ext.data.Store({
reader: reader,
autoCommit: true,
data: []
}),
cm: new xg.ColumnModel({
defaults: {
sortable: true
},
columns: [
//sm,
{header: "Author-it Job Name", sortable: true, dataIndex: 'jobname', width: 300 },
{ header: "Language Pair", sortable: true, dataIndex: 'language', width: 300 },
{ header: "Freeway Project ID", sortable: true, dataIndex: 'projectid', width: 200 },
{ header: "Freeway Project Name", sortable: true, dataIndex: 'projectname', width: 300 },
//{ header: "Price", header: "Action", dataIndex: 'action' }
{header: 'Action', sortable: false, renderer: function (val) { return '<input type="button" value="Import" id="' + val + '"/>'; }, dataIndex: 'action' }
]
}),

columnLines: true,
stripeRows: true,
autoscroll: true,
//width: 600,
height: 300,
frame: true,
//title: 'Freeway Details Grid with CheckBox Selection',
iconCls: 'icon-grid'
});

Ext.getCmp('grd_Overview_JobsReadyForImport').getView().refresh();

slemmon
16 Sep 2013, 8:14 AM
Any chance you could post a stand-alone test case that doesn't have application specific code that would make it easier to run/test?

Also, if you put the code in code tags (using the # button above) it well help make your posted code more readable.

jamiro
16 Jan 2014, 6:28 AM
Hi, you're calling grid.getView().refresh(); which invokes this.grid.stopEditing(true); where this.grid is undefined.
It happends because this.grid.rendered == false at the moment.