[ 1 post ]

Exbi

  • Username: Exbi
  • Joined: Sun Sep 04, 2011 8:55 am
  • Posts: 10
  • Location: Hampshire
  • Offline
  • Profile

problem with Datatable using XML data

Post Posted: Sun Sep 04, 2011 9:11 am
+0-
Hi, really hoping someone can help me with this, have spent way too long banging my head against a brick wall on it.

I have XML data at http://localhost:3000/users.xml

and I have the following datatable code:

Code:
YUI().use("datasource-io", "datatable-base", "datasource-xmlschema", "datatable-datasource", "io", "datasource-textschema", "datasource-get", function(Y) {

        function getData(e) {

   var s_DataSource = new Y.DataSource.IO({source:"http://192.168.2.5:3000/items.xml"});



   s_DataSource.plug(Y.Plugin.DataSourceXMLSchema,{
      schema: {
         resultListLocator: "item",
         resultFields: [


            {key:"item"},
            {key:"condition"},
            {key:"color"},
            {key:"keep"},

         ]
           }
       });


   s_DataSource.sendRequest({
      callback: {
         success: function(e) {
            Y.log(e);
         }
      }
   });

   var cols = ["item", "condition", "color", "keep"];
   var table = new Y.DataTable.Base({
      columnset:cols,
      summary: "test table",
   });
   
   table.plug(Y.Plugin.DataTableDataSource,{
      datasource: s_DataSource,
      initialRequest: ""
   });

   s_DataSource.after("response", function(){
      table.render("#xml")
   });
     };
});


It seems to work, as it pulls the data onto my page, however -
1. It's displaying as a text table, but it's not showing the usual datatable look/style (I think I've included all the dependencies). I'm obviously missing something though.

2. every other row is displaying as 'null' in each column...is this a symptom of the problem in 1.)? Or is something else not working properly?

I have included this css -
Code:
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/datatable/assets/skins/sam/datatable.css" />


Any ideas? Thanks in advance
  [ 1 post ]
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