PDA

View Full Version : yu-ext GRID xml data loading problem



patukk
5 Oct 2006, 9:05 AM
Hey yiu-ext people.I am using the grid to load xml data but i am having trouble loading some xml constructs
e.g am using this schema to try and get the VALIDATION required="true" value from this xml but its not loading a value.

<TEXTFIELD name="FirstName" display="First Name"datatype="string">
<VALIDATION required="true" />
</TEXTFIELD>


var schema =
{
tagName: 'TEXTFIELD',
id: 'use-index',
fields: ['name' , 'display', 'datatype', 'VALIDATION']
};

dataModel = new YAHOO.ext.grid.XMLDataModel(schema);
var yg = YAHOO.ext.grid;
var myColumns = [
{header: "name", width: 200, editor: new yg.TextEditor()},
{header: "display", width: 200, editor: new yg.TextEditor()},
{header: "datatype", width: 250, editor: new yg.TextEditor()},
{header: "validation required", width: 250, editor: new yg.TextEditor()}
];

Any help will be appreciated Thanks

jack.slocum
5 Oct 2006, 11:45 AM
That's a tough one. The default implementation only supports attributes or child nodes, but not attributes on child nodes.

What you may want to do is take a look at the implementation of loadData() in XMLDataModel, and then override it with an implementation that can load your structure. It shouldn't be very difficult and since your logic won't need to test if it's a node or attribute (since you will know) it should improve performance as well.

patukk
6 Oct 2006, 8:07 AM
Thanks alot jacksloc ill try to override loadData()