[ 3 posts ]

Javier Barceló

  • Username: barceyken
  • Joined: Wed May 16, 2012 11:29 pm
  • Posts: 2
  • Offline
  • Profile

Problem getting data from HTMLtable wth DataSourceXMLSchema

Post Posted: Wed May 16, 2012 11:56 pm
+0-
Hi everyone,
I'm starting try to upgrade a webapp from YUI2 to YUI3 and get a litle issue when trying to upgrade the datatables, the table data are stored local in HTML table format, looking for tutorials and examples I can upgrade it easy and displayed well but I got a litle problem...

when I get the cell data with the schema i only get the text on that cell but I need the HTML tags like spans or divs in the cell that the Schema didn't load, u know how can retrieve it ? with YUI2 i get it without problems but in YUI3 I dont know to do that :S

in var myTableData the is the rigth HTML code of the table.
maybe trying change the locator: "td[1]" for other ...

thanks and sorry for my crappy english.

Code:
   
fieldDefs[0] = {key: "proyecto", locator: "td[1]", allowHTML:true};
                ...
myDataSource.plug(Y.Plugin.DataSourceXMLSchema, {
schema: {
   resultListLocator: "tr",
   resultFields: fieldDefs}
});

colDefs[0] = {   key: "proyecto",
   label: "Proyecto",
   allowHTML: true,
   nodeFormatter: function (o) {
   o.cell.set('innerHTML',o.value);
}
...
};
      

Alberto Santini

YUI Contributor

  • Offline
  • Profile

Re: Problem getting data from HTMLtable wth DataSourceXMLSch

Post Posted: Thu May 17, 2012 7:06 am
+0-
Hola Javier.

I think you may give a look at 'allowHTML':

http://yuilibrary.com/yui/docs/datatable/#formatters

Hope that helps,
IceBox

P.S.: Ops... I think I misunderstood the issue, because you are using that configuration.
If you provide a jsfiddle snippet (or a public link), it would be better (for me).

Javier Barceló

  • Username: barceyken
  • Joined: Wed May 16, 2012 11:29 pm
  • Posts: 2
  • Offline
  • Profile

Re: Problem getting data from HTMLtable wth DataSourceXMLSch

Post Posted: Fri May 18, 2012 2:20 am
+0-
Ciao Alberto ^^,

txs for your Answer, but I think that the Xpath cant get InnerHTML in this case and tryed a lot of things :(, the unique solution I found is copy all elements one to one from the HTML table to YUI datatable,...

but at the end we erased the HTML table and get the data for the YUI datatable using AJAX, looks better plus easy dynamic reload and edit :D.

Thanks ;)
  [ 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