View Full Version : How to keep inavigation or paging in Grid

4 Jan 2007, 1:26 AM
Hi All,

I'm working with Grid and I'm trying to keep a navigation (or paging to navigate some records at a time). But when i use initPaging() method I'm getting the structure of navigation but I'm unable to navigate between the records. In initPaging() method we have to specify the URL but i don't have any URL to pass the records. I'm just using the JSONDataModel to create dataModel. My code is given below

onLoad : function(){ alert("inload");this.grid.getSelectionModel().selectFirstRow();},
init : function() { var schema = { root: 'Users', totalProperty: 'Total', id: 'user', fields: ['Name','Password','Id'] };
var dataObj = {'Users':[{'Name':'Samba','Password':'zxcv','Id':'123'},{'Name':'Stephen','Password':'qwer','Id':'123'},{'Name':'John','Password':'asdf','Id':'123'}]};
var data=eval(dataObj);
var columns= [{ header: "Name", width: 110, sortable: true },{ header: "Password", width: 130, sortable: true },{ header: "Id", width: 75, sortable: true }];
this.dataModel = new YAHOO.ext.grid.JSONDataModel(schema);
this.colModel = new YAHOO.ext.grid.DefaultColumnModel(columns);
this.selModel = new YAHOO.ext.grid.SingleSelectionModel();
this.grid = new YAHOO.ext.grid.Grid('example-grid',this.dataModel,this.colModel,this.selModel);

I also tried this.grid.getview().getPageToolbar() to add navigation tool bar but its not working.

So where and How can i use initPaging() where data is in the form of string.
Is there any way to overcome this to keep navigationbar (or paging).

Thanks in advance,