Code:
Ext.define('Ext.app.SampleGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.gridportlet',
renderTopic: function(value, p, record) {
return Ext.String.format(
'<b><a href="http://sencha.com/forum/showthread.php?t={2}" target="_blank">{0}</a></b><a href="http://sencha.com/forum/forumdisplay.php?f={3}" target="_blank">{1} Forum</a>',
value,
record.data.forumtitle,
record.getId(),
record.data.forumid
);
},
createModel: function() {
debugger;;
return Ext.create('Ext.data.Model', {
fields: [
'title', 'forumtitle', 'forumid', 'username',
{name: 'replycount', type: 'int'},
{name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
'lastposter', 'excerpt', 'threadid'
],
idProperty: 'threadid'
});
},
createProxy: function() {
debugger;;
return Ext.create('Ext.data.proxy.JsonP', {
url: 'http://www.sencha.com/forum/topics-browse-remote.php',
reader: {
root: 'topics',
totalProperty: 'totalCount'
},
// sends single sort as multi parameter
simpleSortMode: true
});
},
createStore: function() {
debugger;;
return Ext.create('Ext.data.Store', {
model: this.createModel,
proxy: this.createProxy,
sorters: [{
property: 'lastpost',
direction: 'DESC'
}]
});
},
initComponent: function() {
debugger;;
var pluginExpanded = true;
Ext.apply(this, {
title: 'ExtJS.com - Browse Forums',
store: this.createStore,
disableSelection: true,
loadMask: true,
columns:[{
id: 'topic',
text: "Topic",
dataIndex: 'title',
flex: 1,
renderer: this.renderTopic,
sortable: false
},{
text: "Author",
dataIndex: 'username',
width: 100,
hidden: true,
sortable: true
},{
text: "Replies",
dataIndex: 'replycount',
width: 70,
align: 'right',
sortable: true
},{
id: 'last',
text: "Last Post",
dataIndex: 'lastpost',
width: 150,
renderer: this.renderLast,
sortable: true
}],
});
this.callParent(arguments);
}
});
But, I am getting the below error on console.