Question

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.

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);
}
...
};
Was it helpful?

Solution

Looks like DataSchema.XML._getLocationValue prefers textContent over innerHTML.

I'd suggest omitting the DataSchema.XML processor and just subscribe to the DataSource's data event and do the value extraction manually. Either that or use something like this: https://gist.github.com/2023955

The alternative is overriding DataSchema.XML._getLocationValue in your sandbox. It's a fairly small method after you trim out the comments.

HTH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top