saasira
11 Dec 2006, 7:47 AM
Hi! everybody,
I
can some one help me in solving this issue?
I'm posting the code I've written below:
var UsersXMLGrid = {
onLoad : function(){
this.grid.getSelectionModel().selectFirstRow();
},
init : function() {
var schema = {
root: 'Users',
totalProperty: 'Total',
id: 'user',
fields: ['fullname','company','login','password']
};
var data ={'Users':[
{'user':[{'Name':'Samba Siva Rao','Company':'PrapanSol','Login':'skolusu','Password':'welcome123'}]},
{'user':[{'Name':'Anil','Company':'PrapanSol','Login':'agolla','Password':'welcome'}]}
]};
var columns= [{ header: "Name", width: 145, sortable: true },{ header: "Company", width: 165, sortable: true },{ header: "Login", width: 185, sortable: true },{ header: "Password", width: 100, sortable: true }];
this.dataModel = new YAHOO.ext.grid.JSONDataModel(schema);
this.colModel = new YAHOO.ext.grid.DefaultColumnModel(columns);
this.grid = new YAHOO.ext.grid.Grid('example-grid', this.dataModel, this.colModel);
this.grid.render();
this.grid.dataModel.loadData(data);
}
};
YAHOO.util.Event.on(window, 'load', UsersXMLGrid.init, UsersXMLGrid, true);
Where am I doing wrong?
I'm getting empty rows with out any data.
Can you please help me?
Thanking you in advance,
Samba
I
can some one help me in solving this issue?
I'm posting the code I've written below:
var UsersXMLGrid = {
onLoad : function(){
this.grid.getSelectionModel().selectFirstRow();
},
init : function() {
var schema = {
root: 'Users',
totalProperty: 'Total',
id: 'user',
fields: ['fullname','company','login','password']
};
var data ={'Users':[
{'user':[{'Name':'Samba Siva Rao','Company':'PrapanSol','Login':'skolusu','Password':'welcome123'}]},
{'user':[{'Name':'Anil','Company':'PrapanSol','Login':'agolla','Password':'welcome'}]}
]};
var columns= [{ header: "Name", width: 145, sortable: true },{ header: "Company", width: 165, sortable: true },{ header: "Login", width: 185, sortable: true },{ header: "Password", width: 100, sortable: true }];
this.dataModel = new YAHOO.ext.grid.JSONDataModel(schema);
this.colModel = new YAHOO.ext.grid.DefaultColumnModel(columns);
this.grid = new YAHOO.ext.grid.Grid('example-grid', this.dataModel, this.colModel);
this.grid.render();
this.grid.dataModel.loadData(data);
}
};
YAHOO.util.Event.on(window, 'load', UsersXMLGrid.init, UsersXMLGrid, true);
Where am I doing wrong?
I'm getting empty rows with out any data.
Can you please help me?
Thanking you in advance,
Samba