View Full Version : Please help! very frustrated
I got some XML here: http://sllik.homeip.net/digibazaar/test.php
And I want to display it in a gird here: http://sllik.homeip.net/digibazaar/test.html
But it's not being displayed! Please help.
2 Nov 2006, 7:12 PM
Did you set an xml header in your php file?
2 Nov 2006, 7:37 PM
Here's a quote:
Next we create our Grid object. The first parameter to the grid constructor is the container element where the grid is to be rendered. The grid adapts to the containers size - so the container MUST have a size. For example, rendering the grid to a div tag with no width and height specified will result in the grid adapting to a width and height of 0 and not appearing. Also, if the container does not have a position set of absolute or relative, the grid will automatically make it relative. The next parameters are the objects we created in step 1 and 2.
This is a good tutorial to help you get started:
Setting overflow:hidden on the container element is also recommended.
thanks for your reply but I still have no luck here... when I view the genrated source I still don't see any data.
3 Nov 2006, 10:00 AM
Did you try and step thru the load method? Is it even getting your data - I'm not sure whether you can just load a page name, rather than specifying a URL.
3 Nov 2006, 10:27 AM
nope still not showing anything
3 Nov 2006, 10:30 AM
As a followup, you won't see the data if you do a 'view source' since it's added to the dom dynamically.
Try loading your xml inline from a variable rather than via the connection manager -
this will eliminate 1 possible point of failure (e.g. not accessing the php file correctly)
var data = '<xml><threads><thread><title>My thread 1</title><postusername>sllik</postusername><dateline>1162150278</dateline><replycount>0</replycount><views>3</views></thread><thread><title>This site is for sale</title><postusername>sllik</postusername><dateline>1162150292</dateline><replycount>0</replycount><views>2</views></thread></threads>';
Then change your code to load from the var
var xml = (new DOMParser()).parseFromString(data, 'text/xml');
this.dataModel = new YAHOO.ext.grid.XMLDataModel(schema, xml);
// this.dataModel = new YAHOO.ext.grid.XMLDataModel(schema);
this.dataModel.addPreprocessor(2, parseDate); // add preprocessor to col 1 to parse dates
this.dataModel.setDefaultSort(colModel, 2, 'DESC');
// create single selection model
this.selModel = new YAHOO.ext.grid.SingleSelectionModel();
//this.selModel.onRowSelect.subscribe(this.showPost, this, true);
this.grid = new YAHOO.ext.grid.Grid('thread-grid', this.dataModel, colModel, this.selModel);
If this doesn't work, or doesn't display correctly in a grid, it's likely an issue of a missing include
for a js or css file, since I was able to pull your page down and make it work locally.
3 Nov 2006, 10:41 AM
thanks for your help tryanDLS, this seems to work..... but why isn't it reading the data from test.php??
3 Nov 2006, 10:57 AM
I don't know since I can't load your php page cross-domain and I'm not running PHP locally.
I would suggest you change the load call to a fully qualified URL. If that doesn't work, change your page to include the debug version of yui-ext.js, set a BP and step thru the load method.
Powered by vBulletin® Version 4.1.5 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.