[ 3 posts ]

Raju

  • Username: rajuipl
  • Joined: Thu Jan 19, 2012 4:51 am
  • Posts: 31
  • GitHub: rajuipl
  • Gists: rajuipl
  • IRC: RajuIpl
  • Offline
  • Profile

YUI datatable "Data Error" help

Post Posted: Thu Jan 19, 2012 5:23 am
+0-
Data: which is from aspx page. getting the dataset and using folllowing code
string s = ds.GetXml();
Response.ContentType = "text/xml";
Response.Write("<?xml version=\"1.0\"?> ");
Response.Write(s);
Response.End();
and am getting the following response in aspx page.

<?xml version="1.0" ?>
- <NewDataSet>
- <Table>
<ID>1</ID>
<FName>XXX</FName>
<LName>I</LName>
</Table>
- <Table>
<ID>2</ID>
<FName>Naresh</FName>
<LName>K</LName>
</Table>
- <Table>
<ID>3</ID>
<FName>Tirumal</FName>
<LName>R</LName>
</Table>
- <Table>
<ID>4</ID>
<FName>Tirupathi</FName>
<LName>E</LName>
</Table>
- <Table>
<ID>5</ID>
<FName>Raju</FName>
<LName>K</LName>
</Table>
</NewDataSet>

Script:

YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.XHR_XML = function() {
var myColumnDefs = [
{key:"ID", label:"ID", sortable:true},
{key:"FName", label:"FName", sortable:true},
{key:"LName", label:"LName", sortable:true}
];

var myDataSource = new YAHOO.util.DataSource("http://localhost:3471/products-w3cdom.xml");
myDataSource.connMethodPost = true;
myDataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
myDataSource.useXPath = true;

myDataSource.responseSchema =
{ resultNode: 'Product',
fields: [{key:'ID'},{key:'FName'},{key:'LName'}]
};

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

return {
oDS: myDataSource,
oDT: myDataTable
};
}();
});

Html container:
<div id="xml"></div>

from html page with the above script am getting "DataError". Help me in this where am going wrong.

Kai Schwarz

  • Username: papakai
  • Joined: Fri Nov 13, 2009 8:26 am
  • Posts: 301
  • Location: Germany
  • Offline
  • Profile

Re: YUI datatable "Data Error" help

Post Posted: Fri Jan 20, 2012 1:22 am
+0-
your problem is the resultNode. you have no node "Product" in your xml answer.
change it to table and try again.

Raju

  • Username: rajuipl
  • Joined: Thu Jan 19, 2012 4:51 am
  • Posts: 31
  • GitHub: rajuipl
  • Gists: rajuipl
  • IRC: RajuIpl
  • Offline
  • Profile
Tags:

Re: YUI datatable "Data Error" help

Post Posted: Mon Jan 23, 2012 12:48 am
+0-
I have done the changes but am getting the same error.

I got it. Actually the request is not going to the aspx page. i missed connection-min.js in ref section.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum