Copy link to clipboard
Copied
I want my data to fill a data grid
but I am getting a comma delimmited grid with only one record and all of the data going into the first record as comma delimited data.
what am I doing wrong here?
Thanks in advance.
--------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<s:Group
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="
library://ns.adobe.com/flex/spark"
xmlns:mx="
library://ns.adobe.com/flex/halo" width="760" height="398" xmlns:mx1="library://ns.adobe.com/flex/mx" xmlns:functiondata="services.functiondata.*">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
getDataResult.token = functionData.getData();
getDataResult2.token = functionData.getData();
}
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getDataResult"/>
<functiondata:FunctionData id="functionData" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<s:CallResponder id="getDataResult2"/>
</fx:Declarations>
<s:Label x="0" y="0" text="Operating Procedures" fontWeight="bold" fontSize="15" textDecoration="underline"/>
<s:Label x="0" y="23" text="DAGR KEY PAD" fontStyle="italic" fontWeight="bold"/>
<mx1:VRule x="392" y="0" height="100%"/>
<s:RichText x="401" y="44" text="* The DAGR obtains current position by simply turning the DAGR on with an open view of the sky." width="45%" fontStyle="italic"/>
<s:Label x="408" y="0" text="POWER ON" fontSize="15" fontWeight="bold" textDecoration="underline"/>
<s:Label x="405" y="77" text="a) Push and release the PWR/QUIT key to turn the DAGR on."/>
<s:RichText x="406" y="91" text="b) The POWER ON STATUS message is displayed for two seconds (If a CV Key, GUV key, SV code, internal compass condition exist, acknowledge message accordingly), then the SV Sky View Page is automatically displayed if the following are true. (1) Self-test has passed; (2) DAGR does not need initialization." width="45%"/>
<s:RichText x="427" y="179" text="c) From the SV Sky View page, the DAGR automatically displays the present position page after acquiring the current position. " width="45%"/>
<s:Label x="409" y="211" text="POWER OFF" fontSize="15" fontWeight="bold" textDecoration="underline"/>
<s:Label x="403" y="233" text="a) Push and hold PWR/QUIT key for 2 seconds."/>
<s:Label x="403" y="246" text="b) DAGR displays WARNING acknowledge as necessary"/>
<s:Label x="400" y="264" text="DISPLAY LIGHTING" fontSize="15" fontWeight="bold" textDecoration="underline"/>
<s:Label x="397" y="287" text="a) If keypad/Display lighting is required, turn display light on/off by pushing and holding the BRIGHTNESS/MENY key." width="45%"/>
<s:Label x="398" y="341" text="b) Display lighting on/off status can be verified by observing the display lighting status indicator." width="45%"/>
<s:TextArea x="10" y="40" width="374" editable="true" fontSize="13">
<s:text><![CDATA[* All of the keys on the DAGR keypad are duel function (primary/secondary) except for the cursor (arrow) keys. Each duel function key is labeled with two sets of letters. All primary function keys are labeled with large letters and all secondary functions are labeled with smaller letters. Push and release to activate the primary function of the key. Push and hold (for 2 seconds) to activate the secondary function of the key. Use cursor keys to scroll up and down as well as left and right within pages. Press and release the QUIT/PWR key and POS/PAGE key to advance from one page to another.]]></s:text>
</s:TextArea>
<mx1:DataGrid x="47" y="211" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getDataResult2.lastResult.category}">
<mx1:columns>
<mx1:DataGridColumn headerText="category" dataField="category"/>
<mx1:DataGridColumn headerText="category_id" dataField="category_id"/>
<mx1:DataGridColumn headerText="categoryName" dataField="categoryName"/>
</mx1:columns>
</mx1:DataGrid>
</s:Group>
-------------------------------------
You xml document is formatted as one row
Dan Prid3
Copy link to clipboard
Copied
Remove category fromthe dataGrid dataProvider
dataProvider="{getDataResult2.lastResult.category}">
Copy link to clipboard
Copied
All I get out of the Datagrid is the [object category] on the first record of the data grid.
-----------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<s:Group
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="
library://ns.adobe.com/flex/spark"
xmlns:mx="
library://ns.adobe.com/flex/halo" width="760" height="398" xmlns:mx1="library://ns.adobe.com/flex/mx" xmlns:functiondata="services.functiondata.*">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
getDataResult.token = functionData.getData();
}
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getDataResult"/>
<functiondata:FunctionData id="functionData" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
</fx:Declarations>
<s:Label x="0" y="0" text="Operating Procedures" fontWeight="bold" fontSize="15" textDecoration="underline"/>
<s:Label x="0" y="23" text="DAGR KEY PAD" fontStyle="italic" fontWeight="bold"/>
<mx1:VRule x="392" y="0" height="100%"/>
<s:RichText x="401" y="44" text="* The DAGR obtains current position by simply turning the DAGR on with an open view of the sky." width="45%" fontStyle="italic"/>
<s:Label x="408" y="0" text="POWER ON" fontSize="15" fontWeight="bold" textDecoration="underline"/>
<s:Label x="405" y="77" text="a) Push and release the PWR/QUIT key to turn the DAGR on."/>
<s:RichText x="406" y="91" text="b) The POWER ON STATUS message is displayed for two seconds (If a CV Key, GUV key, SV code, internal compass condition exist, acknowledge message accordingly), then the SV Sky View Page is automatically displayed if the following are true. (1) Self-test has passed; (2) DAGR does not need initialization." width="45%"/>
<s:RichText x="427" y="179" text="c) From the SV Sky View page, the DAGR automatically displays the present position page after acquiring the current position. " width="45%"/>
<s:Label x="409" y="211" text="POWER OFF" fontSize="15" fontWeight="bold" textDecoration="underline"/>
<s:Label x="403" y="233" text="a) Push and hold PWR/QUIT key for 2 seconds."/>
<s:Label x="403" y="246" text="b) DAGR displays WARNING acknowledge as necessary"/>
<s:Label x="400" y="264" text="DISPLAY LIGHTING" fontSize="15" fontWeight="bold" textDecoration="underline"/>
<s:Label x="397" y="287" text="a) If keypad/Display lighting is required, turn display light on/off by pushing and holding the BRIGHTNESS/MENY key." width="45%"/>
<s:Label x="398" y="341" text="b) Display lighting on/off status can be verified by observing the display lighting status indicator." width="45%"/>
<s:TextArea x="10" y="40" width="374" editable="true" fontSize="13">
<s:text><![CDATA[* All of the keys on the DAGR keypad are duel function (primary/secondary) except for the cursor (arrow) keys. Each duel function key is labeled with two sets of letters. All primary function keys are labeled with large letters and all secondary functions are labeled with smaller letters. Push and release to activate the primary function of the key. Push and hold (for 2 seconds) to activate the secondary function of the key. Use cursor keys to scroll up and down as well as left and right within pages. Press and release the QUIT/PWR key and POS/PAGE key to advance from one page to another.]]></s:text>
</s:TextArea>
<mx1:DataGrid x="10" y="211" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getDataResult.lastResult}">
<mx1:columns>
<mx1:DataGridColumn headerText="category" dataField="category"/>
</mx1:columns>
</mx1:DataGrid>
</s:Group>
----------------------------------------------
Copy link to clipboard
Copied
Now the data grid is pulling all of the records from the XML file as the top record in the data grid with off of the data from the xml file as comma delimited.
App Code:
--------------------------
<?xml version="1.0" encoding="utf-8"?>
<s:Group
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="
library://ns.adobe.com/flex/spark"
xmlns:mx="
library://ns.adobe.com/flex/halo" width="760" height="398" xmlns:mx1="library://ns.adobe.com/flex/mx" xmlns:functiondata="services.functiondata.*">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
getDataResult.token = functionData.getData();
}
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getDataResult"/>
<functiondata:FunctionData id="functionData" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
</fx:Declarations>
<s:Label x="0" y="0" text="Operating Procedures" fontWeight="bold" fontSize="15" textDecoration="underline"/>
<s:Label x="0" y="23" text="DAGR KEY PAD" fontStyle="italic" fontWeight="bold"/>
<mx1:VRule x="392" y="0" height="100%"/>
<s:RichText x="401" y="44" text="* The DAGR obtains current position by simply turning the DAGR on with an open view of the sky." width="45%" fontStyle="italic"/>
<s:Label x="408" y="0" text="POWER ON" fontSize="15" fontWeight="bold" textDecoration="underline"/>
<s:Label x="405" y="77" text="a) Push and release the PWR/QUIT key to turn the DAGR on."/>
<s:RichText x="406" y="91" text="b) The POWER ON STATUS message is displayed for two seconds (If a CV Key, GUV key, SV code, internal compass condition exist, acknowledge message accordingly), then the SV Sky View Page is automatically displayed if the following are true. (1) Self-test has passed; (2) DAGR does not need initialization." width="45%"/>
<s:RichText x="427" y="179" text="c) From the SV Sky View page, the DAGR automatically displays the present position page after acquiring the current position. " width="45%"/>
<s:Label x="409" y="211" text="POWER OFF" fontSize="15" fontWeight="bold" textDecoration="underline"/>
<s:Label x="403" y="233" text="a) Push and hold PWR/QUIT key for 2 seconds."/>
<s:Label x="403" y="246" text="b) DAGR displays WARNING acknowledge as necessary"/>
<s:Label x="400" y="264" text="DISPLAY LIGHTING" fontSize="15" fontWeight="bold" textDecoration="underline"/>
<s:Label x="397" y="287" text="a) If keypad/Display lighting is required, turn display light on/off by pushing and holding the BRIGHTNESS/MENY key." width="45%"/>
<s:Label x="398" y="341" text="b) Display lighting on/off status can be verified by observing the display lighting status indicator." width="45%"/>
<s:TextArea x="10" y="40" width="374" editable="true" fontSize="13">
<s:text><![CDATA[* All of the keys on the DAGR keypad are duel function (primary/secondary) except for the cursor (arrow) keys. Each duel function key is labeled with two sets of letters. All primary function keys are labeled with large letters and all secondary functions are labeled with smaller letters. Push and release to activate the primary function of the key. Push and hold (for 2 seconds) to activate the secondary function of the key. Use cursor keys to scroll up and down as well as left and right within pages. Press and release the QUIT/PWR key and POS/PAGE key to advance from one page to another.]]></s:text>
</s:TextArea>
<mx1:DataGrid x="10" y="211" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getDataResult.lastResult}">
<mx1:columns>
<mx1:DataGridColumn headerText="catID" dataField="catID"/>
<mx1:DataGridColumn headerText="categoryName" dataField="categoryName"/>
</mx1:columns>
</mx1:DataGrid>
</s:Group>
--------------------------
XML File:
-------------------------
<?
xml version="1.0" encoding="utf-8" ?>
<
main>
<catID>1</catID>
<categoryName>F1/FUNCTION KEY</categoryName>
<catID>2</catID>
<categoryName>F2/OUT FUNCTION KEY</categoryName>
<catID>3</catID>
<categoryName>F3/STATUS FUNCTION KEY</categoryName>
<catID>4</catID>
<categoryName>POS/PAGE KEY</categoryName>
<catID>5</catID>
<categoryName>BRIGHTNESS/MENU KEY</categoryName>
<catID>6</catID>
<categoryName>WP/ENTER KEY</categoryName>
<catID>7</catID>
<categoryName>RIGHT CURSOR CONTROL KEY</categoryName>
<catID>8</catID>
<categoryName>DOWN CURSOR CONTROL KEY</categoryName>
<catID>9</catID>
<categoryName>LEFT CURSOR CONTROL KEY</categoryName>
<catID>10</catID>
<categoryName>UP CURSOR CONTROL KEY</categoryName>
<catID>11</catID>
<categoryName>PWR/QUIT KEY</categoryName>
</
main>
Copy link to clipboard
Copied
You xml document is formatted as one row
Dan Prid3
Copy link to clipboard
Copied
Really,
Privide and example of column formatting please
Copy link to clipboard
Copied
New format.......
--------------------------------
<main>
<row>
<catID>1</catID >
<CategoryName>F1/FUNCTION KEY</CategoryName >
</row>
<row>
<catID>3</catID >
<CategoryName>F3/STATUS FUNCTION KEY</CategoryName >
</row>
<row>
<catID>4</catID >
<CategoryName>POS/PAGE KEY</CategoryName >
</row>
<row>
<catID>5</catID >
<CategoryName>BRIGHTNESS/MENU KEY</CategoryName >
</row>
<row>
<catID>6</catID >
<CategoryName>WP/ENTER KEY</CategoryName >
</row>
<row>
<catID>7</catID >
<CategoryName>RIGHT CURSOR CONTROL KEY</CategoryName >
</row>
<row>
<catID>8</catID >
<CategoryName>DOWN CURSOR CONTROL KEY</CategoryName >
</row>
<row>
<catID>9</catID >
<CategoryName>LEFT CURSOR CONTROL KEY</CategoryName >
</row>
<row>
<catID>10</catID >
<CategoryName>UP CURSOR CONTROL KEY</CategoryName >
</row>
<row>
<catID>11</catID >
<CategoryName>PWR/QUIT KEY</CategoryName >
</row>
</main>
==================