Hi,

 I am having problems with initializing my combo box cell renderer.

 I have a application initialize method call which calls a few
httpservice to get data

function appInit()
 {
        clcrSSrv.send();
        clStatSrv.send();
        clTypeSrv.send();
        initCellRenderer();
 }

the method initCellRenderer()

private function initCellRenderer() : Void          
  {
        var comboBoxValues = clTypeSrv.result.types.type;
     ComboBoxCellRenderer.dataProvider = comboBoxValues;
  }

where 'ComboBoxCellRenderer' is my cell renderer and is a Action
script class file.

in the createchildren method i have 

function createChildren(Void) : Void
        {
                super.createChildren();
                
                createClassObject( Label, "comboLabel", 1, { styleName:this,
owner:this } );
                createClassObject( ComboBox, "combo", 2, { styleName:this,
owner:this, selectable:true } );
                
                combo.addEventListener( "change", this );
                combo.addEventListener( "enter", this );
                
                combo.dataProvider = ComboBoxCellRenderer.dataProvider;
                
                combo.setStyle( "backgroundColor", getStyle( "selectionColor" ) 
);
                changeFlag = false;
                size();
        }


my datagrid 

<mx:DataGrid id="rsClients"
dataProvider="{findClientSrv.result.clients.client}"
change="selectClient(rsClients.selectedIndex)" height="100%"
toolTip="Client List" borderStyle="none" editable="true">
                                        <mx:columns>
                                                <mx:Array>
                                                        <mx:DataGridColumn 
columnName="clid" headerText="Client ID"
marginLeft="4" />
                                                        <mx:DataGridColumn 
columnName="clName" headerText="Client Name"
marginLeft="4" />
                                                        <mx:DataGridColumn 
columnName="clType" headerText="Client Type"
marginLeft="4" cellRenderer="{ComboBoxCellRenderer}" editable="false"/>
                                                        <mx:DataGridColumn 
columnName="clCrStatus" headerText="Credit
Status" marginLeft="4"/>
                                                        <mx:DataGridColumn 
columnName="clStatus" headerText="Client
Status" marginLeft="5" />
                                                        <mx:DataGridColumn 
columnName="name" headerText="Name"
marginLeft="5"/>
                                                        <mx:DataGridColumn 
columnName="city" headerText="City"
marginLeft="4"/>
                                                        <mx:DataGridColumn 
columnName="state" headerText="State"
marginLeft="4"/>
                                                        <mx:DataGridColumn 
columnName="zip" headerText="Zip"
marginLeft="5"/>
                                                </mx:Array>
                                        </mx:columns>
                                </mx:DataGrid>

Now this setup works fine some times.. sometimes the cellrenderer does
not have any data, even though it is the same(single static)  query
and i can see the data coming back from the jsp. I am thinking that
the createchildren method if called before the jsp has returned data
so I changed my httpservie to have result="initCellRenderer()"

<mx:HTTPService id="clTypeSrv" url="clTypes.jsp"
result="initCellRenderer()" showBusyCursor="true" />

even this creates the combobox sometimes and not all times.. 

I tried debugging and see the dataprovider is undefined inside the
createchildren method.

And also I found the createchildren method was called a total of 12
times initially, even though there are no rows to be shown initially.

Can anyone tell me how to solve the missing data problem and also why
the cellrenderer is being initialized 12 times.

Rajesh J





 
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/
 


Reply via email to