17 November, 2008

Simple ExtJs Grid Example 2

var store;
var temp;
Ext.onReady(function()
{

var arr=document.getElementById("hdnField1").value;
var splitter=arr.split("|");
var myData = [[splitter[0],splitter[1]]];
// create the data store
store = new Ext.data.SimpleStore
({
fields: [{name: 'Name'},{name: 'Designation'}]
});
store.loadData(myData);
// create the Grid
var grid = new Ext.grid.GridPanel
({
store: store,
columns: [{header: "Name", sortable: true, dataIndex: 'Name'},{header: "Designation", sortable: true, renderer: 'Designation'}],
stripeRows: true,height:320,width:240,title:'Array Grid'
});
grid.render('grid-example');
});

var clicked=function()
{
var TopicRecord = Ext.data.Record.create(
{name: 'Name', mapping: 'Name'},
{name: 'Designation', mapping: 'Designation'}
);

var myNewRecord = new TopicRecord({
Name: 'Do my job please',
Designation: 'noobie'
});
store.add(myNewRecord);
return false;
}

0 comments:

Post a Comment