I have an array collection object 'invArrayCol' which holds some data. I also have a datagrid. I have set dataProvider as invArrayCol.I displays the data properly when i use it with data grid. But the same invArrayCol shows null when used anywhere other than datagrid. I wrote this code
protected function titlewindow1_creationCompleteHandler(event:FlexEvent):void
{
Cgt=new CgtSRObject();
var autoobj:CSAutoNumberType=new CSAutoNumberType();
autoobj.addEventListener(ResultEvent.RESULT,getInvNubmer);
autoobj.getInvNo(invoiceType);
trace(robj.salesPerson_Id);
getSalesReturnCgt.token=csInvoicePrint.getCgtData(robj.receive_Id);
getSalesReturnCgt.addEventListener(ResultEvent.RESULT,getInvArrList);
trace(Cgt.sr_no);
datagrid_dataprovider=new ArrayCollection();
datagrid_dataprovider=invArrayCol;
calculateTotal();
}
This 2 lines set data to invArrayCol
getSalesReturnCgt.token=csInvoicePrint.getCgtData(robj.receive_Id);
getSalesReturnCgt.addEventListener(ResultEvent.RESULT,getInvArrList);
But here it gives value of invArrayCol as null.
datagrid_dataprovider=new ArrayCollection();
datagrid_dataprovider=invArrayCol;
Please tell me some way out of this.
invArrayColis null. But in the code you have shown, this variable is never assigned a value (so it's going to be null). The code snippets you have shown are not sufficient to diagnose the problem. Also, why do you set the data grid's dataProvider twice? The first time to a new ArrayCollection, then the second time toinvArrayCol?