PDA

View Full Version : trying to get columns from XML Stream



mhubert
20 May 2007, 8:55 PM
reader: new Ext.data.XmlReader({
// records will have an "row" tag
record: 'row',
totalRecords: 'total'
}, ['id','carrier','detail'])
});


I would like to take the definition ['id','carrier','detail'] from the xmlstream -- e.g. <columns>id,carrier,detail</columns>

how would I do that?

on a similar note
var cm = new Ext.grid.ColumnModel([
{header: "id", width: 120, dataIndex: 'id'},
{header: "carrier", width: 80, dataIndex: 'carrier'},
{header: "detail", width: 285, dataIndex: 'detail'}
]);


is there a way to set width: autofit? and could I read the above also from the XML data stream? If so how.

Thanks for any help and pointers

Animal
20 May 2007, 11:23 PM
You'd have to extend XmlReader to extract the information. Have it pull the field defs out and create an Ext.data.Record constructor, and pull the column specs out and create a ColumnModel.

It's not that difficult. All the tools are there in Ext for you to write it.

mhubert
21 May 2007, 5:08 PM
Animal -- thanks -- since I am still somewhat new to EXT -- do you have any pointer on where I would start -- are there any examples on how to extend a ext component?
who would I get at the xml data?
Or could I just specify an ALL property to get all the columns in the result row?

Thanks again