PDA

View Full Version : Extjs 4.2 grid bug



SenchaTry5
22 May 2013, 10:24 PM
When grid have selected row clicking a column header Firebug reports error: TypeError: c is undefined. ext-all.js (line 21)

My grid have store that buffered and remoteSort enabled.

slemmon
24 May 2013, 10:32 AM
I tried to reproduce the error by modifying the buffered example from the sencha.com website > ExtJS > examples page and did not seen an error thrown when using 4.2.1 (released yesterday). If you're using 4.2 can you try with 4.2.1 and see if you fare better? If not, can you provide an inclusive test case to demonstrate the issue?

http://docs.sencha.com/extjs/4.2.0/extjs-build/examples/grid/infinite-scroll-with-filter.html

My test case used:


Ext.onReady(function(){
Ext.define('ForumThread', {
extend: 'Ext.data.Model',
fields: [{
name: 'title',
mapping: 'topic_title'
}, {
name: 'forumtitle',
mapping: 'forum_title'
}, {
name: 'forumid',
type: 'int'
}, {
name: 'username',
mapping: 'author'
}, {
name: 'replycount',
mapping: 'reply_count',
type: 'int'
}, {
name: 'lastpost',
mapping: 'post_time',
type: 'date',
dateFormat: 'timestamp'
},
'lastposter', 'excerpt', 'topic_id'
],
idProperty: 'post_id'
});


// create the Data Store
var store = Ext.create('Ext.data.Store', {
id: 'store',
model: 'ForumThread',
// allow the grid to interact with the paging scroller by buffering
buffered: true,

// The topics-remote.php script appears to be hardcoded to use 50, and ignores this parameter, so we
// are forced to use 50 here instead of a possibly more efficient value.
pageSize: 50,


// This web service seems slow, so keep lots of data in the pipeline ahead!
leadingBufferZone: 1000,
proxy: {
// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
type: 'jsonp',
url: 'http://www.sencha.com/forum/topics-remote.php',
reader: {
root: 'topics',
totalProperty: 'totalCount'
},
// sends single sort as multi parameter
simpleSortMode: true,

// Parameter name to send filtering information in
filterParam: 'query',


// The PHP script just use query=<whatever>
encodeFilters: function(filters) {
return filters[0].value;
}
},
listeners: {
totalcountchange: onStoreSizeChange
},
remoteFilter: true,
remoteSort: true,
autoLoad: true
});

function onStoreSizeChange() {
grid.down('#status').update({count: store.getTotalCount()});
}


function renderTopic(value, p, record) {
return Ext.String.format(
'<a href="http://sencha.com/forum/showthread.php?p={1}" target="_blank">{0}</a>',
value,
record.getId()
);
}


var grid = Ext.create('Ext.grid.Panel', {
width: 700,
height: 500,
collapsible: true,
title: 'ExtJS.com - Browse Forums',
store: store,
loadMask: true,
dockedItems: [{
dock: 'top',
xtype: 'toolbar',
items: [{
width: 400,
fieldLabel: 'Search',
labelWidth: 50,
xtype: 'searchfield',
store: store
}, '->', {
xtype: 'component',
itemId: 'status',
tpl: 'Matching threads: {count}',
style: 'margin-right:5px'
}]
}],
selModel: {
pruneRemoved: false
},
multiSelect: true,
viewConfig: {
trackOver: false,
emptyText: '<h1 style="margin:20px">No matching results</h1>'
},
// grid columns
columns:[{
xtype: 'rownumberer',
width: 50
},{
tdCls: 'x-grid-cell-topic',
text: "Topic",
dataIndex: 'title',
flex: 1,
renderer: renderTopic
},{
text: "Author",
dataIndex: 'username',
width: 100,
hidden: true
},{
text: "Replies",
dataIndex: 'replycount',
align: 'center',
width: 70
},{
id: 'last',
text: "Last Post",
dataIndex: 'lastpost',
width: 130,
renderer: Ext.util.Format.dateRenderer('n/j/Y g:i A'),
sortable: false
}],
renderTo: Ext.getBody()
});
});