• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need help with yui.

aceO07

Diamond Member
I just started using the yui libraries yesterday and I want to use the datatable. I can't seem to get it to display my xml file in a table. It gives the error "Data Error" and "No records found" if I try to sort any columns.

I have even tried exact code from their sample with XHR for XML and that works for their datasource. However, If I modify the fields and url to work for my local xml file, it gives me the error.

The XML file is local, on my desktop, as are my html files. I have the yui libraries linked locally as well.

This is my exact js code. I have imported the dom.js, event.js, connection.js, datasource-beta-debug.js, datatable-beta-debugs.js before this section of code.
var myColumnHeaders = [
{key:"id", text:"Name", sortable:true},
{key:"desc"},
{key:"amount"},
];
var myColumnSet = new YAHOO.widget.ColumnSet(myColumnHeaders);

var myDataSource = new YAHOO.util.DataSource("data.xml");
myDataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
myDataSource.responseSchema = {
resultNode: "result",
fields: ["id","desc","amount"]
};

var myDataTable = new YAHOO.widget.DataTable("xml", myColumnSet, myDataSource);

My data.xml file is formated correctly as far as I know.

The css for the table is displayed properly, just no data except that error message. I am using Firefox 2. I have tried it on IE6 too. In IE6, when linked to my xml file, the table does not even show.

Any suggestions?
 
Try it on a server, its possible your browser/pc security settings aren't allowing the script to read the xml file
 
Originally posted by: troytime
Try it on a server, its possible your browser/pc security settings aren't allowing the script to read the xml file

I thought about that one, but all the js files are local so I'm not doing any cross site operations. I checked firebug and it does show that the xml file is downloaded. I have use an online validator to check my xml file and it is valid.

I'm just wondering if there is something that I'm missing.
 
Back
Top