JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://dev.sencha.com/deploy/dev/resources/css/ext-all.css">
<script src="http://dev.sencha.com/deploy/dev/adapter/ext/ext-base.js"></script>
<script src="http://dev.sencha.com/deploy/dev/ext-all.js"></script>
JavaScript
// create the Data Store
var store = new Ext.data.JsonStore({
root: 'topics',
totalProperty: 'totalCount',
idProperty: 'threadid',
remoteSort: true,
fields: [
'title', 'forumtitle', 'forumid', 'author',
{name: 'replycount', type: 'int'},
{name: 'lastpost', type: 'date', dateFormat: 'timestamp'}
],
// load using script tags for cross domain, if the data in on the same domain as this page, an HttpProxy would be better
proxy: new Ext.data.ScriptTagProxy({
url: 'http://extjs.com/forum/topics-browse-remote.php'
})
});
var grid = new Ext.grid.GridPanel({
width:500,
height:400,
title:'ExtJS.com - Browse Forums',
store: store,
trackMouseOver:false,
disableSelection:true,
loadMask: true,
// grid columns
columns:[{
header: "Topic",
dataIndex: 'title',
width: 420,
sortable: true
},{
header: "Author",
dataIndex: 'author',
width: 100,
hidden: true,
sortable: true
},{
header: "Replies",
dataIndex: 'replycount',
width: 70,
align: 'right',
sortable: true
},{
id: 'last',
header: "Last Post",
dataIndex: 'lastpost',
width: 150,
sortable: true
}],
// customize view config
viewConfig: {
forceFit:true,
enableRowBody:true,
showPreview:true
},
// paging bar on the bottom
bbar: new Ext.PagingToolbar({
pageSize: 15,
store: store,
displayInfo: true
})
});
// render it
grid.render(Ext.getBody());
// trigger the data store load
store.load({
params:{start:0, limit:15},
callback: function(result, options, success) {
if (!success) {
alert('Error detected through store.load');
}
}
});
// Listen to "exception" event fired by all proxies
Ext.data.DataProxy.on('exception', function(proxy, type, action, ex) {
...