PDA

View Full Version : architecture problem


Flippie124
01-31-2005, 05:43 PM
Ok, I'm trying to create a dynamic datagrid. The datagrid will be filled by a number of unknown columns that are extracted from an XML file. Each column has it's own cellrenderer type, depending the type from the XML (button, text, combobox). I have a class that extracts all the data from the XML and for each cell there is an object created.
the problem is that I need to create an object for each item(row) in the datagrid. This object needs to have attributes which I cannot define in advance. Then each attribute isn't just a text value. There can be comboboxes,buttons..., What I'm trying to do is create an array filled with row/item objects, loop trough the array and push a new object to the dataprovider. So basically I need to create somekind of row object where I can add attributes dynamically. I tried to do this with prototyping but this seem almost impossible ... I know there must be a better, less complicated way to do this. Are there maby other ways to fill a dataprovider or fill a datagrid?

data_array.push({Model:[{label:"Ford", data:"1000"}, {label:"Chevrolet", data:"800"}, {label:"Renault", data:"1600"}], Year:"Ten"});

->this must become: data_array.push(row[i]);
And row[i] is an object that replaces all that stuff

sorry if this is a bit unclear ...