JSFiddle - React, Tailwind, and code Playground
by sran
HTML
<link rel="stylesheet" href="http://docs.sencha.com/extjs/4.1.3/extjs-build/resources/css/ext-all.css">
JavaScript
Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone', 'id'],
data:{'items':[
{"name":"Lisa", "email":"[email protected]", "phone":"555-111-1224","id": 0},
{"name":"Bart", "email":"[email protected]", "phone":"555-222-1234","id": 1},
{"name":"Homer", "email":"[email protected]", "phone":"555-222-1244","id": 2},
{"name":"Marge", "email":"[email protected]", "phone":"555-222-1254","id": 3},
{"name":"Homer", "email":"[email protected]", "phone":"555-222-1244","id": 4},
{"name":"Marge", "email":"[email protected]", "phone":"555-222-1254","id": 5}
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
// demogrid
var grid = Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
tbar: [
{text:'scroll to top',handler: function(btn){ btn.up('grid').getView().getEl().scrollTo('Top', 0, true); }}
],
columns: [
{header: 'Name', dataIndex: 'name'},
{header: 'Email', dataIndex: 'email', flex:1},
{header: 'Phone', dataIndex: 'phone'},
{header: 'id', dataIndex: 'id'}
],
selType: 'cellmodel',
height: 150,
width: 400,
renderTo: Ext.getBody()
});
// scroll some lines down
grid.getView().getEl().scrollTo('Top', 75, true);