|
List Info
Thread: Selective display with XMLConnector, DataSet and DataGrid
|
|
| Selective display with XMLConnector,
DataSet and DataGrid |
  United Kingdom |
2007-02-18 11:31:31 |
I am learning about data integration and have completed the
elementary "Dinner Menu" exercise at http://livedocs.adobe.com/flash/mx2004/mai
n_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX
_2004&file=00000435.html .
The XML has a root node named <dinner_menu>,
containing multiple nodes named <food>, each of which
contains nodes named <name>, <price>,
<description> and <calories>.
By means of XMLConnector, DataSet and DataGrid, this
information is displayed in columns labelled
"name", "price", "description"
and "calories".
So far it is perfectly simple, but what I now want to modify
the example to display only _selected_ columns in my
DataGrid, for instance to read in the same XML but display
only "name", "price" and
"calories" in my DataGrid, omitting
"description". Nevertheless I don't want to
discard "description"; I want to read it in with
the other data, store it and make it available if the user
requests it.
Can anybody suggest how I can do this, or direct me to any
examples?
Thanks
Andy
_______________________________________________
Flashcoders chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcode
rs
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om
|
|
| Re: Selective display with
XMLConnector, DataSet and DataGrid |
  Belgium |
2007-02-18 13:08:36 |
There's a few ways you can do this, but here is one, using
Bindings through the Component Inspector.
First set the columns for the datagrid.
Add the following code to the first frame (where the button
code is)
this.menu_dg.columnNames = ["name",
"price", "calories"];
Add a TextArea component for the description of the selected
datagrid item to the stage, name it:description_ta
With the TextArea instance selected, set
"editable" to false in the "Parameters"
tab.
Next step is to bind the .text property of the TextArea to
the "description" field of the XML connector.
You could bind the TextArea to the DataSet, but then you'd
have to manually create a schema for the DataSet's
dataProvider in the
Component Inspector. Since the XMLConnector already has a
Schema defined, we'll use that one.
Bind the TextArea's "text" property to the
XMLConnector's "description" property: click the
plus (+) sign, select the "text:String"
property, click "Bound To", click the magnifying
glass icon, select XMLConnector, then select the
"description:String" property.
Select "in" for the direction.
Last thing to do is to tell the TextArea to display the
description of the selected item of the DataGrid.
However you do this through the XMLConnector..
Select the XMLConnector, select the Bindings tab in the
Component Inspector.
There should be 2 Bindings
- results.dinner_menu.food
- results.dinner_menu.food.[n].description
The last one is the one we need. Note that it has
"[n]" in the path, meaning there's multiple
"food" properties and we now need to
tell the XMLConnector which one to use.
Select "results.dinner_menu.food.[n].description"
in the Bindings tab, click "Index for 'food'",
click the magnifying glass icon,
unselect "Use constant value", which will make the
selections at the top available, select "Datagrid"
-> "selectedIndex:Number"
Test the movie.
regards,
Muzak
----- Original Message -----
From: "Andrew Kirkham" <andrewj.kirkham ntlworld.com>
To: <flashcoders chattyfig.figleaf.com>
Sent: Sunday, February 18, 2007 6:31 PM
Subject: [Flashcoders] Selective display with
XMLConnector,DataSet and DataGrid
I am learning about data integration and have completed the
elementary "Dinner Menu" exercise at
http://livedocs.adobe.com/flash/mx2004/mai
n_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX
_2004&file=00000435.html .
The XML has a root node named <dinner_menu>,
containing multiple nodes named <food>, each of which
contains nodes named <name>,
<price>, <description> and <calories>.
By means of XMLConnector, DataSet and DataGrid, this
information is displayed in columns labelled
"name", "price", "description"
and
"calories".
So far it is perfectly simple, but what I now want to modify
the example to display only _selected_ columns in my
DataGrid, for
instance to read in the same XML but display only
"name", "price" and "calories"
in my DataGrid, omitting "description".
Nevertheless I don't want to discard
"description"; I want to read it in with the other
data, store it and make it available if the
user requests it.
Can anybody suggest how I can do this, or direct me to any
examples?
Thanks
Andy
_______________________________________________
Flashcoders chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcode
rs
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om
|
|
| Re: Selective display with
XMLConnector, DataSet and DataGrid |
  United Kingdom |
2007-02-19 03:24:38 |
Thanks "Muzak", that's most useful.
Andy
----- Original Message -----
From: "Muzak" <p.ginneberge telenet.be>
To: "Flashcoders mailing list" <flashcoders chattyfig.figleaf.com>
Sent: Sunday, February 18, 2007 7:08 PM
Subject: Re: [Flashcoders] Selective display with
XMLConnector,DataSet and
DataGrid
> There's a few ways you can do this, but here is one,
using Bindings
> through the Component Inspector.
>
> First set the columns for the datagrid.
> Add the following code to the first frame (where the
button code is)
>
> this.menu_dg.columnNames = ["name",
"price", "calories"];
>
> Add a TextArea component for the description of the
selected datagrid item
> to the stage, name it:description_ta
> With the TextArea instance selected, set
"editable" to false in the
> "Parameters" tab.
>
> Next step is to bind the .text property of the TextArea
to the
> "description" field of the XML connector.
> You could bind the TextArea to the DataSet, but then
you'd have to
> manually create a schema for the DataSet's dataProvider
in the Component
> Inspector. Since the XMLConnector already has a Schema
defined, we'll use
> that one.
>
> Bind the TextArea's "text" property to the
XMLConnector's "description"
> property: click the plus (+) sign, select the
"text:String" property,
> click "Bound To", click the magnifying glass
icon, select XMLConnector,
> then select the "description:String"
property. Select "in" for the
> direction.
>
> Last thing to do is to tell the TextArea to display the
description of the
> selected item of the DataGrid.
> However you do this through the XMLConnector..
> Select the XMLConnector, select the Bindings tab in the
Component
> Inspector.
> There should be 2 Bindings
>
> - results.dinner_menu.food
> - results.dinner_menu.food.[n].description
>
> The last one is the one we need. Note that it has
"[n]" in the path,
> meaning there's multiple "food" properties
and we now need to tell the
> XMLConnector which one to use.
>
> Select
"results.dinner_menu.food.[n].description" in the
Bindings tab,
> click "Index for 'food'", click the
magnifying glass icon, unselect "Use
> constant value", which will make the selections at
the top available,
> select "Datagrid" ->
"selectedIndex:Number"
>
> Test the movie.
>
> regards,
> Muzak
>
>
>
> ----- Original Message -----
> From: "Andrew Kirkham"
<andrewj.kirkham ntlworld.com>
> To: <flashcoders chattyfig.figleaf.com>
> Sent: Sunday, February 18, 2007 6:31 PM
> Subject: [Flashcoders] Selective display with
XMLConnector,DataSet and
> DataGrid
>
>
> I am learning about data integration and have completed
the elementary
> "Dinner Menu" exercise at
> http://livedocs.adobe.com/flash/mx2004/mai
n_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX
_2004&file=00000435.html .
>
> The XML has a root node named <dinner_menu>,
containing multiple nodes
> named <food>, each of which contains nodes named
<name>, <price>,
> <description> and <calories>.
>
> By means of XMLConnector, DataSet and DataGrid, this
information is
> displayed in columns labelled "name",
"price", "description" and
> "calories".
>
> So far it is perfectly simple, but what I now want to
modify the example
> to display only _selected_ columns in my DataGrid, for
instance to read in
> the same XML but display only "name",
"price" and "calories" in my
> DataGrid, omitting "description".
Nevertheless I don't want to discard
> "description"; I want to read it in with the
other data, store it and make
> it available if the user requests it.
>
> Can anybody suggest how I can do this, or direct me to
any examples?
>
> Thanks
> Andy
>
>
> _______________________________________________
> Flashcoders chattyfig.figleaf.com
> To change your subscription options or search the
archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcode
rs
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.c
om
_______________________________________________
Flashcoders chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcode
rs
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om
|
|
[1-3]
|
|