[flexcoders] e4x to Datagrid not removing the tags when rendered
Hello all, I am importing an xml file in air to a datagrid but the data in the grid is still showing the tags. I have tried everying that I can think of. Earlier I tried imporing the file using HTTP server as an object and then got the data to display properly at that point but this has be be imported as xml. AnyIdeas are greatly appreciated.
RE: [SPAM] [flexcoders] e4x to Datagrid not removing the tags when rendered
First, the DataGrid dataProvider itself must be some kind of list. It can be an ArrayCollection, an XMLListCollection, an Array or XMLList(avoid these if you plan to programmatically update the dataProvider) There are two ways to get an HTTPService result into a dataProvider. One is to bind to lastResult.avoid this. Instead, use a resultHandler to assign the appropriate list type to a variable, and bind to that. If you dataProvider is valid, you might have just forgotten to specify the dataField for the columns. If you are setting that property, then you need to know that dataField can only handle a string, not an expression, and the property specified must be a top-level property of the dataProvider item. If the dataProvider items are XML nodes, the datafield must specify a first-level childNode(data in the text node of that node) or an attribute. If it is an attribute then you need to use the @ symbol. Example: dataField="@myAttribute". Hope this helps. Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Quintjer Sent: Sunday, January 17, 2010 10:49 AM To: flexcoders@yahoogroups.com Subject: [SPAM] [flexcoders] e4x to Datagrid not removing the tags when rendered Hello all, I am importing an xml file in air to a datagrid but the data in the grid is still showing the tags. I have tried everying that I can think of. Earlier I tried imporing the file using HTTP server as an object and then got the data to display properly at that point but this has be be imported as xml. AnyIdeas are greatly appreciated.
Re: [SPAM] [flexcoders] e4x to Datagrid not removing the tags when rendered
Thank you for taking the time to answer my question and explaining the datagrid dataprovider. I think what what problem is the way the xml I am importing is formatted. The root node is the name of the xml, then I have the repeating node. Within the repeating node I have data that needs to go in the datagrid. Problem is the tag names within the repeating node. Please see my example: What I need to do is to put the feature data in repeat[0].feature into a datagrid. But because feature is in repeat[0] twice(20 in the real app) it will not load it properly. Any idea how to accomplish this? I have been trying for several weeks now with no luck.Ha! Thanks in advance. --- In flexcoders@yahoogroups.com, "Tracy Spratt" wrote: > > First, the DataGrid dataProvider itself must be some kind of list. It can > be an ArrayCollection, an XMLListCollection, an Array or XMLList(avoid these > if you plan to programmatically update the dataProvider) > > > > There are two ways to get an HTTPService result into a dataProvider. One is > to bind to lastResult.avoid this. Instead, use a resultHandler to assign the > appropriate list type to a variable, and bind to that. > > > > If you dataProvider is valid, you might have just forgotten to specify the > dataField for the columns. > > > > If you are setting that property, then you need to know that dataField can > only handle a string, not an expression, and the property specified must be > a top-level property of the dataProvider item. If the dataProvider items > are XML nodes, the datafield must specify a first-level childNode(data in > the text node of that node) or an attribute. If it is an attribute then you > need to use the @ symbol. Example: dataField="@myAttribute". > > > > Hope this helps. > > > > Tracy Spratt, > > Lariat Services, development services available > > _ > > From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On > Behalf Of Quintjer > Sent: Sunday, January 17, 2010 10:49 AM > To: flexcoders@yahoogroups.com > Subject: [SPAM] [flexcoders] e4x to Datagrid not removing the tags when > rendered > > > > > > Hello all, > I am importing an xml file in air to a datagrid but the data in the grid is > still showing the tags. I have tried everying that I can think of. Earlier I > tried imporing the file using HTTP server as an object and then got the data > to display properly at that point but this has be be imported as xml. > AnyIdeas are greatly appreciated. >
RE: [SPAM] Re: [SPAM] [flexcoders] e4x to Datagrid not removing the tags when rendered
Yes. I think that will give the automatic column generation functionality a problem. I think you should manually loop over the repeat nodes, and for each, populate a value object with strongly typed properties assigned the values from the appropriate feature and value nodes. Your code to make the assignment will have to use the positional syntax instead of e4x filters. For example in psuedocode: Var voRepeat: RepeatVO; For each(var xmlItem:XML in root.repeat) { voRepeat = new RepeatVO(); voRepeat.featue1 = xmlItem.feature[0].text(); voRepeat.featue2 = xmlItem.feature[1].text(); voRepeat.value1 = xmlItem.value[0].text(); . myArrayCollection.addItem(voRepeat) } MydataGrid.dataProvider = myArrayCollection; Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Quintjer Sent: Monday, January 18, 2010 11:33 AM To: flexcoders@yahoogroups.com Subject: [SPAM] Re: [SPAM] [flexcoders] e4x to Datagrid not removing the tags when rendered Thank you for taking the time to answer my question and explaining the datagrid dataprovider. I think what what problem is the way the xml I am importing is formatted. The root node is the name of the xml, then I have the repeating node. Within the repeating node I have data that needs to go in the datagrid. Problem is the tag names within the repeating node. Please see my example: What I need to do is to put the feature data in repeat[0].feature into a datagrid. But because feature is in repeat[0] twice(20 in the real app) it will not load it properly. Any idea how to accomplish this? I have been trying for several weeks now with no luck.Ha! Thanks in advance. --- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com, "Tracy Spratt" wrote: > > First, the DataGrid dataProvider itself must be some kind of list. It can > be an ArrayCollection, an XMLListCollection, an Array or XMLList(avoid these > if you plan to programmatically update the dataProvider) > > > > There are two ways to get an HTTPService result into a dataProvider. One is > to bind to lastResult.avoid this. Instead, use a resultHandler to assign the > appropriate list type to a variable, and bind to that. > > > > If you dataProvider is valid, you might have just forgotten to specify the > dataField for the columns. > > > > If you are setting that property, then you need to know that dataField can > only handle a string, not an expression, and the property specified must be > a top-level property of the dataProvider item. If the dataProvider items > are XML nodes, the datafield must specify a first-level childNode(data in > the text node of that node) or an attribute. If it is an attribute then you > need to use the @ symbol. Example: dataField="@myAttribute". > > > > Hope this helps. > > > > Tracy Spratt, > > Lariat Services, development services available > > _ > > From: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com [mailto:flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com] On > Behalf Of Quintjer > Sent: Sunday, January 17, 2010 10:49 AM > To: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com > Subject: [SPAM] [flexcoders] e4x to Datagrid not removing the tags when > rendered > > > > > > Hello all, > I am importing an xml file in air to a datagrid but the data in the grid is > still showing the tags. I have tried everying that I can think of. Earlier I > tried imporing the file using HTTP server as an object and then got the data > to display properly at that point but this has be be imported as xml. > AnyIdeas are greatly appreciated. >