jcarey03
12-02-2006, 06:39 PM
I have been trying to get xml data loaded into a grid. I looked at the code example posted: http://www.jackslocum.com/blog/2006/08/31/a-grid-component-for-yahoo-ui-part-2/ and modeled my code after it. When I run my code, there is no data displayed in the grid and no errors. All the files exist locally on my machine. I noticed other people have had this problem as well, but I have not seen a solution to it. Please help.
Thanks,
Jason
Here is some of my code:
var SubscriptionGrid = {
init : function(){
var schema = {
tagName: 'subscription',
id: 'id',
fields: ['title', 'status', 'lastUpdate']
};
dataModel = new YAHOO.ext.grid.XMLDataModel(schema);
// the DefaultColumnModel expects this blob to define columns. It can be extended to provide
// custom or reusable ColumnModels
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "Subscription", width: 180, sortable: true},
{header: "Status", width: 100, sortable: true},
{header: "Last Update", width: 100, sortable: true}
]);
// create the Grid
var grid = new YAHOO.ext.grid.Grid('subscriptionWrapper', dataModel, colModel);
grid.autoWidth = true;
grid.autoHeight = true;
grid.render();
dataModel.load('../../data/subscription.xml', '');
}
}
YAHOO.ext.EventManager.onDocumentReady(SubscriptionGrid.init, SubscriptionGrid, true);
Thanks,
Jason
Here is some of my code:
var SubscriptionGrid = {
init : function(){
var schema = {
tagName: 'subscription',
id: 'id',
fields: ['title', 'status', 'lastUpdate']
};
dataModel = new YAHOO.ext.grid.XMLDataModel(schema);
// the DefaultColumnModel expects this blob to define columns. It can be extended to provide
// custom or reusable ColumnModels
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "Subscription", width: 180, sortable: true},
{header: "Status", width: 100, sortable: true},
{header: "Last Update", width: 100, sortable: true}
]);
// create the Grid
var grid = new YAHOO.ext.grid.Grid('subscriptionWrapper', dataModel, colModel);
grid.autoWidth = true;
grid.autoHeight = true;
grid.render();
dataModel.load('../../data/subscription.xml', '');
}
}
YAHOO.ext.EventManager.onDocumentReady(SubscriptionGrid.init, SubscriptionGrid, true);