PDA

View Full Version : Error in grid with content menu while sorting data



webfriend13
3 Jul 2012, 1:07 AM
Hi All,


I have added a context menu on my grid. If user Right Clicks on a grid cell, I give him option to copy the content. Following is the code





var menuContext = new Ext.menu.Menu({
items: [{
icon: 'content/icons/copy.png',
text: 'Copy'
}],
listeners: {
click: function (menu, item, e, eOpts) {
var selModel = selGrid.getSelectionModel();
if (selModel.hasSelection()) {
var str;
var selColumnNum = selModel.nextSelection.column;
var selColumnField = selModel.nextSelection.record.fields.items[selColumnNum].name;
str = selModel.nextSelection.record.data[selColumnField];
if (window.clipboardData && clipboardData.setData) {
clipboardData.setData('text', str);
}
}
}
}
});




If user right clicks on the grid and then tries to sort the grid, I am getting "Microsoft JScript runtime error: 'viewIndex' is null or not an object" error.

When user clicks on sort, I am making an Ajax request and then I am binding data to store. using following code. Somewhere during this call, I am getting the error.



myGridStore.loadRawData(Ext.decode(responseData.responseText), false);

mitchellsimoens
6 Jul 2012, 2:26 PM
Why are you doing an Ajax call and not using the ajax proxy to do the loading?