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 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.
---------------------------------------------------------------------------






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to