Re: [flexcoders] Populating values in datagrid from arrays
Try casting the result to an Array ... myArray= mx.utils.ArrayUtil.toArray(event.result); It worked for me in a similar case ... Parekh, Shweta - BLS CTRTo: 'flexcoders@yahoogroups.com' flexcoders@yahoogroups.com [EMAIL PROTECTED] cc: Sent by: Subject: [flexcoders] Populating values in datagrid from arrays flexcoders@yahoogroups.com 10/03/2005 02:19 PM Please respond to flexcoders Hi, I am having problem populating values in my datagrid. From my mxml, I make a remote call to my controller which returns an array of ItemVOs. ItemVO has one-dimensional integer array, containing values for columns in each row in the datagrid. i.e. if my int array in ItemVO1 contains values 1, 2 and array in ItemVO2 contains values 3,4, then my datagrid should display 12 34 Instead the code below displays my datagrid as 1,2 1,2 3,4 3,4 Code: mx:RemoteObject id=itemDetailController source=controllers.ItemDetailController showBusyCursor=true mx:method name=getColSpecData result=result_ColSpecData=event.result mx:arguments arg1{itemSid}/arg1 arg2{irMonth}/arg2 arg3{monthNo}/arg3 /mx:arguments /mx:method /mx:RemoteObject mx:VBox mx:DataGrid id=colSpec_dg width=600 dataProvider={result_ColSpecData} textAlign=left height=250 headerHeight=50 editable=true mx:columns mx:Array mx:DataGridColumn headerText=A columnName=colSpecData width=50 textAlign=left/ mx:DataGridColumn headerText=B columnName=colSpecData width=100 textAlign=left/ /mx:Array /mx:columns /mx:DataGrid mx:FormItem direction=horizontal width=100% height=30 mx:Text text=value: width=90/mx:Spacer height=63/ mx:Text id=tobEffIrm text={itemDetailController.getColSpecData.result[0].colSpecData[0]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm1 text={itemDetailController.getColSpecData.result[0].colSpecData[1]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm2 text={itemDetailController.getColSpecData.result[1].colSpecData[0]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm3 text={itemDetailController.getColSpecData.result[1].colSpecData[1]} width=57/mx:Spacer height=63/ /mx:FormItem If I replace colSpecData with colSpecData[0] and colSpecData[1], datagrid does not show any values. But the text field displays values fine as 1 2 3 4. I fail to understand why the dataprovider in the datagrid does not work with indexes specified. Can anybody please help me with this. Thanks in advance, Shweta -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links --- This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender and erase this e-mail message immediately. --- Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back!
RE: [flexcoders] Populating values in datagrid from arrays
Title: Message Hi, I type casted the result as you have suggested here. But still my datagrid does not display the values. import classes.ItemSpecVO; var itemSpecVO:ItemSpecVO;var myArray:Array;var itemSpecVO1:ItemSpecVO;var specdata_arr; function getdata(result){mx.controls.Alert.show("inside getdata - len"+result.length);myArray= mx.utils.ArrayUtil.toArray(result);itemSpecVO=myArray[0];mx.controls.Alert.show("d0: "+itemSpecVO.colSpecData[0]); -- prints value correctlymx.controls.Alert.show("d1: "+itemSpecVO.colSpecData[1]); -- prints value correctlyitemSpecVO1=myArray[1];mx.controls.Alert.show("d0: "+itemSpecVO1.colSpecData[0]); -- prints value correctlymx.controls.Alert.show("d1: "+itemSpecVO1.colSpecData[1]); -- prints value correctlyspecdata_arr=itemSpecVO.colSpecData[0];specdata_arr=itemSpecVO.colSpecData[1];specdata_arr=itemSpecVO1.colSpecData[0];specdata_arr=itemSpecVO1.colSpecData[1];} mx:RemoteObject id="itemDetailController" source="gov.bls.ppi.janus.repricing.manageitems.controllers.ItemDetailController" showBusyCursor="true"mx:method name="getColSpecData" result="getdata(event.result)" mx:arguments arg1{itemSid}/arg1 arg2{irMonth}/arg2 arg3{monthNo}/arg3/mx:arguments/mx:method/mx:RemoteObject mx:VBox mx:DataGrid id="colSpec_dg" width="600" dataProvider="{specdata_arr}" textAlign="left" height="250" headerHeight="50" editable="true" mx:columns mx:Array mx:DataGridColumn headerText="A" columnName="A" width="50" textAlign="left"/ mx:DataGridColumn headerText="B" columnName="B" width="100" textAlign="left"/ /mx:Array /mx:columns /mx:DataGrid /mx:VBox What could be the problem? Thanks, Shweta -Original Message-From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]Sent: Monday, October 03, 2005 3:06 PMTo: flexcoders@yahoogroups.comSubject: Re: [flexcoders] Populating values in datagrid from arraysTry casting the result to an Array ... myArray= mx.utils.ArrayUtil.toArray(event.result);It worked for me in a similar case ... "Parekh, Shweta - BLS CTR" To: "'flexcoders@yahoogroups.com'" flexcoders@yahoogroups.com [EMAIL PROTECTED] cc: Sent by: Subject: [flexcoders] Populating values in datagrid from arrays flexcoders@yahoogroups.com 10/03/2005 02:19 PM Please respond to flexcoders Hi,I am having problem populating values in my datagrid. From my mxml, I makearemote call to my controller which returns an array of ItemVOs.ItemVO has one-dimensional integer array, containing values for columns ineach row in the datagrid. i.e. if my int array in ItemVO1 contains values1,2 and array in ItemVO2 contains values 3,4, then my datagrid should display 1 2 3 4Instead the code below displays my datagrid as 1,2 1,2 3,4 3,4Code:mx:RemoteObject id="itemDetailController"source="controllers.ItemDetailController" showBusyCursor="true" mx:method name="getColSpecData"result="result_ColSpecData=event.result" mx:arguments arg1{itemSid}/arg1 arg2{irMonth}/arg2 arg3{monthNo}/arg3 /mx:arguments /mx:method/mx:RemoteObjectmx:VBox mx:DataGrid id="colSpec_dg" width="600"dataProvider="{result_ColSpecData}" textAlign="left" height="250"headerHeight="50" editable="true" mx:columns mx:Array mx:DataGridColumn headerText="A"columnName="colSpecData" width="50" textAlign="left"/ mx:DataGridColumn headerText="B"columnName="colSpecData" width="100" textAlign="left"/ /mx:Array /mx:columns /mx:DataGridmx:FormItem direction="horizontal" width="100%" height="30" mx:Text text="value:" width="90"/mx:Spacer height="63"/ mx:Text id="tobEffIrm"text="{itemDetailController.getColSpecData.result[0].colSpecData[0]}"width="57"/mx:Spacer height="63"/ mx:Text id="tobEffIrm1"text="{itemDetailController.getColSpecData.result[0].colSpecData[1]}"width="57"/mx:Spacer height="63"/ mx:Text id="tobEffIrm2"text="{itemDetailController.getColSpecData.result[1].colSpecData[0]}"width="57"/mx:Spacer height="63"/ mx:Text id="tobEffIrm3"text="{itemDetailController.getColSpecData.result[1].colSpecData[1]}"width="57"/mx:Spacer height="63"//mx:FormItemIf I replace colSpecData with colSpecData[0] and colSpecData[1], datagriddoes not show any values. But the text field displays values fine as 1 2 34.I fail to understand why the dataprovider in the datagrid does not workwithindexes specified. Can anybody please help me with this.Thanks in advance,Shweta--Flexcoders Mailing ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links---This e-mail message (including attachments, if any) is intended for the useof the individual or
RE: [flexcoders] Populating values in datagrid from arrays
You are going to need a labelFunction to do this, instead of columnName. private function lblfArray0(oItem:Object):String { return oItem.colSpecData[0]; } mx:DataGridColumn headerText=A labelFunction=lblfArray0 width=50 textAlign=left/ Tracy -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Parekh, Shweta - BLS CTR Sent: Monday, October 03, 2005 2:19 PM To: 'flexcoders@yahoogroups.com' Subject: [flexcoders] Populating values in datagrid from arrays Hi, I am having problem populating values in my datagrid. From my mxml, I make a remote call to my controller which returns an array of ItemVOs. ItemVO has one-dimensional integer array, containing values for columns in each row in the datagrid. i.e. if my int array in ItemVO1 contains values 1, 2 and array in ItemVO2 contains values 3,4, then my datagrid should display 12 34 Instead the code below displays my datagrid as 1,2 1,2 3,4 3,4 Code: mx:RemoteObject id=itemDetailController source=controllers.ItemDetailController showBusyCursor=true mx:method name=getColSpecData result=result_ColSpecData=event.result mx:arguments arg1{itemSid}/arg1 arg2{irMonth}/arg2 arg3{monthNo}/arg3 /mx:arguments /mx:method /mx:RemoteObject mx:VBox mx:DataGrid id=colSpec_dg width=600 dataProvider={result_ColSpecData} textAlign=left height=250 headerHeight=50 editable=true mx:columns mx:Array mx:DataGridColumn headerText=A columnName=colSpecData width=50 textAlign=left/ mx:DataGridColumn headerText=B columnName=colSpecData width=100 textAlign=left/ /mx:Array /mx:columns /mx:DataGrid mx:FormItem direction=horizontal width=100% height=30 mx:Text text=value: width=90/mx:Spacer height=63/ mx:Text id=tobEffIrm text={itemDetailController.getColSpecData.result[0].colSpecData[0]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm1 text={itemDetailController.getColSpecData.result[0].colSpecData[1]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm2 text={itemDetailController.getColSpecData.result[1].colSpecData[0]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm3 text={itemDetailController.getColSpecData.result[1].colSpecData[1]} width=57/mx:Spacer height=63/ /mx:FormItem If I replace colSpecData with colSpecData[0] and colSpecData[1], datagrid does not show any values. But the text field displays values fine as 1 2 3 4. I fail to understand why the dataprovider in the datagrid does not work with indexes specified. Can anybody please help me with this. Thanks in advance, Shweta -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links Yahoo! Groups Sponsor ~-- Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Populating values in datagrid from arrays
Title: Message The problem is that when your getdata() function executes you set specdata_arr equal to a single value instead of an array then you repeat that step 4 times. Also, unless your array has a column called A and another one called B its not going to display anything even if you set it correctly. From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Parekh, Shweta - BLS CTR Sent: Monday, October 03, 2005 4:53 PM To: 'flexcoders@yahoogroups.com' Subject: RE: [flexcoders] Populating values in datagrid from arrays Hi, I type casted the result as you have suggested here. But still my datagrid does not display the values. import classes.ItemSpecVO; var itemSpecVO:ItemSpecVO; var myArray:Array; var itemSpecVO1:ItemSpecVO; var specdata_arr; function getdata(result) { mx.controls.Alert.show(inside getdata - len+result.length); myArray= mx.utils.ArrayUtil.toArray(result); itemSpecVO=myArray[0]; mx.controls.Alert.show(d0: +itemSpecVO.colSpecData[0]); -- prints value correctly mx.controls.Alert.show(d1: +itemSpecVO.colSpecData[1]); -- prints value correctly itemSpecVO1=myArray[1]; mx.controls.Alert.show(d0: +itemSpecVO1.colSpecData[0]); -- prints value correctly mx.controls.Alert.show(d1: +itemSpecVO1.colSpecData[1]); -- prints value correctly specdata_arr=itemSpecVO.colSpecData[0]; specdata_arr=itemSpecVO.colSpecData[1]; specdata_arr=itemSpecVO1.colSpecData[0]; specdata_arr=itemSpecVO1.colSpecData[1]; } mx:RemoteObject id=itemDetailController source=gov.bls.ppi.janus.repricing.manageitems.controllers.ItemDetailController showBusyCursor=true mx:method name=getColSpecData result=getdata(event.result) mx:arguments arg1{itemSid}/arg1 arg2{irMonth}/arg2 arg3{monthNo}/arg3 /mx:arguments /mx:method /mx:RemoteObject mx:VBox mx:DataGrid id=colSpec_dg width=600 dataProvider={specdata_arr} textAlign=left height=250 headerHeight=50 editable=true mx:columns mx:Array mx:DataGridColumn headerText=A columnName=A width=50 textAlign=left/ mx:DataGridColumn headerText=B columnName=B width=100 textAlign=left/ /mx:Array /mx:columns /mx:DataGrid /mx:VBox What could be the problem? Thanks, Shweta -Original Message- From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of [EMAIL PROTECTED] Sent: Monday, October 03, 2005 3:06 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Populating values in datagrid from arrays Try casting the result to an Array ... myArray= mx.utils.ArrayUtil.toArray(event.result); It worked for me in a similar case .. Parekh, Shweta - BLS CTR To: 'flexcoders@yahoogroups.com' flexcoders@yahoogroups.com [EMAIL PROTECTED] cc: Sent by: Subject: [flexcoders] Populating values in datagrid from arrays flexcoders@yahoogroups.com 10/03/2005 02:19 PM Please respond to flexcoders Hi, I am having problem populating values in my datagrid. From my mxml, I make a remote call to my controller which returns an array of ItemVOs. ItemVO has one-dimensional integer array, containing values for columns in each row in the datagrid. i.e. if my int array in ItemVO1 contains values 1, 2 and array in ItemVO2 contains values 3,4, then my datagrid should display 1 2 3 4 Instead the code below displays my datagrid as 1,2 1,2 3,4 3,4 Code: mx:RemoteObject id=itemDetailController source=controllers.ItemDetailController showBusyCursor=true mx:method name=getColSpecData result=result_ColSpecData=event.result mx:arguments arg1{itemSid}/arg1 arg2{irMonth}/arg2 arg3{monthNo}/arg3 /mx:arguments /mx:method /mx:RemoteObject mx:VBox mx:DataGrid id=colSpec_dg width=600 dataProvider={result_ColSpecData} textAlign=left height=250 headerHeight=50 editable=true mx:columns mx:Array mx:DataGridColumn headerText=A columnName=colSpecData width=50 textAlign=left/ mx:DataGridColumn headerText=B columnName=colSpecData width=100 textAlign=left/ /mx:Array /mx:columns /mx:DataGrid mx:FormItem direction=horizontal width=100% height=30 mx:Text text=value: width=90/mx:Spacer height=63/ mx:Text id=tobEffIrm text={itemDetailController.getColSpecData.result[0].colSpecData[0]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm1 text={itemDetailController.getColSpecData.result[0].colSpecData[1]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm2 text={itemDetailController.getColSpecData.result[1].colSpecData[0]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm3 text={itemDetailController.getColSpecData.result[1].colSpecData[1]} width=57/mx:Spacer height=63/ /mx:FormItem If I replace colSpecData with colSpecData[0] and colSpecData[1], datagrid does not show any values. But the text field displays values fine as 1 2 3 4. I fail to understand why the dataprovider in the datagrid does not work with indexes specified. Can anybody please help me with this. Thanks in advance, Shweta -- Flexcoders Mailing List FAQ
RE: [flexcoders] Populating values in datagrid from arrays
Title: Message As Kelly says, just do: specdata_arr=itemSpecVO1.colSpecData And then use a labelFunction instead of the columnName. Tracy From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Kelly Roman Sent: Monday, October 03, 2005 8:14 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Populating values in datagrid from arrays The problem is that when your getdata() function executes you set specdata_arr equal to a single value instead of an array then you repeat that step 4 times. Also, unless your array has a column called A and another one called B its not going to display anything even if you set it correctly. From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Parekh, Shweta - BLS CTR Sent: Monday, October 03, 2005 4:53 PM To: 'flexcoders@yahoogroups.com' Subject: RE: [flexcoders] Populating values in datagrid from arrays Hi, I type casted the result as you have suggested here. But still my datagrid does not display the values. import classes.ItemSpecVO; var itemSpecVO:ItemSpecVO; var myArray:Array; var itemSpecVO1:ItemSpecVO; var specdata_arr; function getdata(result) { mx.controls.Alert.show(inside getdata - len+result.length); myArray= mx.utils.ArrayUtil.toArray(result); itemSpecVO=myArray[0]; mx.controls.Alert.show(d0: +itemSpecVO.colSpecData[0]); -- prints value correctly mx.controls.Alert.show(d1: +itemSpecVO.colSpecData[1]); -- prints value correctly itemSpecVO1=myArray[1]; mx.controls.Alert.show(d0: +itemSpecVO1.colSpecData[0]); -- prints value correctly mx.controls.Alert.show(d1: +itemSpecVO1.colSpecData[1]); -- prints value correctly specdata_arr=itemSpecVO.colSpecData[0]; specdata_arr=itemSpecVO.colSpecData[1]; specdata_arr=itemSpecVO1.colSpecData[0]; specdata_arr=itemSpecVO1.colSpecData[1]; } mx:RemoteObject id=itemDetailController source=gov.bls.ppi.janus.repricing.manageitems.controllers.ItemDetailController showBusyCursor=true mx:method name=getColSpecData result=getdata(event.result) mx:arguments arg1{itemSid}/arg1 arg2{irMonth}/arg2 arg3{monthNo}/arg3 /mx:arguments /mx:method /mx:RemoteObject mx:VBox mx:DataGrid id=colSpec_dg width=600 dataProvider={specdata_arr} textAlign=left height=250 headerHeight=50 editable=true mx:columns mx:Array mx:DataGridColumn headerText=A columnName=A width=50 textAlign=left/ mx:DataGridColumn headerText=B columnName=B width=100 textAlign=left/ /mx:Array /mx:columns /mx:DataGrid /mx:VBox What could be the problem? Thanks, Shweta -Original Message- From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of [EMAIL PROTECTED] Sent: Monday, October 03, 2005 3:06 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Populating values in datagrid from arrays Try casting the result to an Array ... myArray= mx.utils.ArrayUtil.toArray(event.result); It worked for me in a similar case .. Parekh, Shweta - BLS CTR To: 'flexcoders@yahoogroups.com' flexcoders@yahoogroups.com [EMAIL PROTECTED] cc: Sent by: Subject: [flexcoders] Populating values in datagrid from arrays flexcoders@yahoogroups.com 10/03/2005 02:19 PM Please respond to flexcoders Hi, I am having problem populating values in my datagrid. From my mxml, I make a remote call to my controller which returns an array of ItemVOs. ItemVO has one-dimensional integer array, containing values for columns in each row in the datagrid. i.e. if my int array in ItemVO1 contains values 1, 2 and array in ItemVO2 contains values 3,4, then my datagrid should display 1 2 3 4 Instead the code below displays my datagrid as 1,2 1,2 3,4 3,4 Code: mx:RemoteObject id=itemDetailController source=controllers.ItemDetailController showBusyCursor=true mx:method name=getColSpecData result=result_ColSpecData=event.result mx:arguments arg1{itemSid}/arg1 arg2{irMonth}/arg2 arg3{monthNo}/arg3 /mx:arguments /mx:method /mx:RemoteObject mx:VBox mx:DataGrid id=colSpec_dg width=600 dataProvider={result_ColSpecData} textAlign=left height=250 headerHeight=50 editable=true mx:columns mx:Array mx:DataGridColumn headerText=A columnName=colSpecData width=50 textAlign=left/ mx:DataGridColumn headerText=B columnName=colSpecData width=100 textAlign=left/ /mx:Array /mx:columns /mx:DataGrid mx:FormItem direction=horizontal width=100% height=30 mx:Text text=value: width=90/mx:Spacer height=63/ mx:Text id=tobEffIrm text={itemDetailController.getColSpecData.result[0].colSpecData[0]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm1 text={itemDetailController.getColSpecData.result[0].colSpecData[1]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm2 text={itemDetailController.getColSpecData.result[1].colSpecData[0]} width=57/mx:Spacer height=63/ mx:Text id=tobEffIrm3 text={itemDetailController.getColSpecData.result[1].colSpecData[1]} width=57/mx:Spacer