<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
width="100%" height="100%" creationComplete="addItems()">
<mx:Script>
<![CDATA[
import mx.controls.CheckBox;
import mx.collections.ArrayCollection;
public var arrRawData:ArrayCollection = new ArrayCollection();
public function addItems():void
{
arrRawData.addItem({id:'A', parentId:null,name:'NameA'});
arrRawData.addItem({id:'D', parentId:'A',name:'NameD'});
arrRawData.addItem({id:'F', parentId:'D',name:'NameF'});
arrRawData.addItem({id:'G', parentId:'F',name:'NameG'});
arrRawData.addItem({id:'H', parentId:'F',name:'NameH'});
arrRawData.addItem({id:'E', parentId:'A',name:'NameE'});
arrRawData.addItem({id:'B', parentId:null,name:'NameB'});
arrRawData.addItem({id:'C', parentId:null,name:'NameC'});
arrRawData.addItem({id:'I', parentId:'C',name:'NameI'});
}
]]>
</mx:Script>
<mx:AdvancedDataGrid id="myADG"
width="100%" height="177"
backgroundColor="#EEECD1" visible="true"
dataProvider="{arrRawData}">
<mx:columns>
<mx:AdvancedDataGridColumn dataField="id" headerText="Id" />
<mx:AdvancedDataGridColumn dataField="parentId"
headerText="ParentId" />
<mx:AdvancedDataGridColumn dataField="name"
headerText="Name" />
<mx:AdvancedDataGridColumn headerText="CheckBox"
itemRenderer="mx.controls.CheckBox"/>
</mx:columns>
</mx:AdvancedDataGrid>
<mx:DataGrid id="myDG"
backgroundColor="#EEECD1" visible="true"
dataProvider="{arrRawData}" x="0" y="185" width="1024">
<mx:columns>
<mx:DataGridColumn dataField="id" headerText="Id" />
<mx:DataGridColumn dataField="parentId"
headerText="ParentId" />
<mx:DataGridColumn dataField="name" headerText="Name" />
<mx:DataGridColumn headerText="CheckBox"
itemRenderer="mx.controls.CheckBox"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
Now in the above code ..................i hav given Checkbox renderer.
Now Run this code ........and check the checkboxes ..............after
checking , just scroll down and
u will come to kno the problem i am facing .
On Mon, Nov 17, 2008 at 9:32 PM, Venkat Viswanathan
<[EMAIL PROTECTED]>wrote:
> Hi Roshan,
>
> In your itemRenderer, override the set data() method. Inside the method, do
> super.data = value. And after that, call the chek_Unchek() method.
>
> It should work after you do this.
>
> Regards,
> Venkat
> www.venkatv.com
>
>
> On Mon, Nov 17, 2008 at 7:30 PM, sheetal nilwant <[EMAIL PROTECTED]
> > wrote:
>
>> Hi Roshan,
>> Even i tried running the code.But couldnt do the same coz of
>> dependencies.I agree with Sathish first try to zero down to the issue.Remove
>> all the dependencies and check the logic for checking and unchecking the
>> check boxes.One that is confirm then we can check this code.
>>
>>
>> On Mon, Nov 17, 2008 at 7:13 PM, Sathish Kumar <
>> [EMAIL PROTECTED]> wrote:
>>
>>> Hi Roshan,
>>> I think the code that you have pasted is not an independent application
>>> ... It has some dependency with your code base (For E.g : Class Named
>>> "SCIUpdated" ). and hence am ot able to execute and see what happens ...
>>>
>>> Anyways... Here are my suggestions.....
>>>
>>> Since your renderer has logic for enable and disable check box, There
>>> could be some miscalculations here ... to confirm this when you scroll,
>>> Print the Data and see whether the data is changed ..... if yes , then
>>> problem is with your Data Handling.. if not then the problem is in your
>>> 'Paint Logic" ....
>>>
>>> Once we confirm that, we can find the appropriate solution ......
>>>
>>> Also, If possible, try making an independent application where you can
>>> execute and see the problem and mail us . In that case, we will be able to
>>> help you better ...
>>>
>>> -Sathish
>>>
>>>
>>> On Mon, Nov 17, 2008 at 6:39 PM, Roshan Pillai <[EMAIL PROTECTED]
>>> > wrote:
>>>
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
>>>> horizontalScrollPolicy="off" horizontalAlign="center"
>>>> creationComplete="chek_Unchek()">
>>>>
>>>> <mx:Script>
>>>> <![CDATA[
>>>> import mx.core.Application;
>>>>
>>>> import mx.controls.Alert;
>>>> import mx.collections.*;
>>>> import flash.events.Event;
>>>>
>>>>
>>>>
>>>> public var tmpVarSCI:SCIUpdated =
>>>> SCIUpdated(Application.application);
>>>>
>>>> public function chek_Unchek():void
>>>> {
>>>> if(tmpVarSCI.cols == tmpVarSCI.arrcols.length -2)
>>>> tmpVarSCI.cols = 0;
>>>>
>>>> var temArr:Array = getVal(tmpVarSCI.cols + 1);
>>>> tmpVarSCI.cols++;
>>>>
>>>> chkBoxes.selected = data[temArr[0]];
>>>> if(data.children==null)
>>>> {
>>>> chkBoxes.enabled=true;
>>>> }
>>>> else
>>>> {
>>>> chkBoxes.enabled=false;
>>>> }
>>>> chkBoxes.selectedField = temArr[1];
>>>>
>>>> }
>>>> private function getVal(i:int):Array
>>>> {
>>>> for(var ctr:int = 0; ctr < tmpVarSCI.arrcols.length; ctr++)
>>>> {
>>>> if(ctr == i)
>>>> {
>>>> var tempstr:String = tmpVarSCI.arrcols[ctr].dataField.toString();
>>>> var temparr:Array = tempstr.split("~");
>>>> return temparr;
>>>> }
>>>> }
>>>> return null;
>>>> }
>>>>
>>>> private function updateSubscriptionArray(ev:Event):void
>>>> {
>>>>
>>>> var AccId:String = ev.currentTarget.parent.data.Parent;
>>>> var ProdId:String = ev.currentTarget.selectedField;
>>>> var OppId:String = tmpVarSCI.ArrOppRecords[0].Id;
>>>> if(ev.currentTarget.selected)
>>>> {
>>>>
>>>> tmpVarSCI.ArrSaveSubscription.addItem({AccountId:ev.currentTarget.parent.data.Parent,
>>>> ProductId:ev.currentTarget.selectedField,
>>>> OppId:tmpVarSCI.ArrOppRecords[0].Id});
>>>> }
>>>> else
>>>> {
>>>> RemoveExistingRecord(AccId, ProdId, OppId);
>>>> }
>>>> }
>>>> private function RemoveExistingRecord(AccId:String, ProdId:String,
>>>> OppId:String):void
>>>> {
>>>> var isOk:Boolean = false;
>>>> for(var i:int = 0; i < tmpVarSCI.ArrSaveSubscription.length; i++)
>>>> {
>>>> if(tmpVarSCI.ArrSaveSubscription[i].AccountId == AccId &&
>>>> tmpVarSCI.ArrSaveSubscription[i].ProductId == ProdId &&
>>>> tmpVarSCI.ArrSaveSubscription[i].OppId == OppId )
>>>> {
>>>> tmpVarSCI.ArrSaveSubscription.removeItemAt(i);
>>>> isOk = true;
>>>> break;
>>>> }
>>>> }
>>>> if(!isOk)
>>>> {
>>>> for(var i:int = 0; tmpVarSCI.arrPriceBookEntry.length; i++)
>>>> {
>>>> if(AccId == tmpVarSCI.arrPriceBookEntry[i].Account__c && ProdId ==
>>>> tmpVarSCI.arrPriceBookEntry[i].Product__c && OppId ==
>>>> tmpVarSCI.arrPriceBookEntry[i].Opportunity__c)
>>>> {
>>>>
>>>> tmpVarSCI.ArrDeleteSubscription.addItem({Id:tmpVarSCI.arrPriceBookEntry[i].Id});
>>>> break;
>>>> }
>>>> }
>>>> }
>>>> tmpVarSCI.ArrSaveSubscription.refresh();
>>>> }
>>>> ]]>
>>>> </mx:Script>
>>>>
>>>> <mx:CheckBox id="chkBoxes" click="updateSubscriptionArray(event);" />
>>>>
>>>> </mx:VBox>
>>>>
>>>>
>>>> On Mon, Nov 17, 2008 at 6:36 PM, Vinod M. Jacob <[EMAIL PROTECTED]>wrote:
>>>>
>>>>> Would you paste your sample code?
>>>>>
>>>>> On Mon, Nov 17, 2008 at 5:59 PM, sheetal nilwant <
>>>>> [EMAIL PROTECTED]> wrote:
>>>>>
>>>>>> Hi,
>>>>>> can u pls elaborate the prob.
>>>>>> what do u mean by changing.Or plz paste the code snippet.
>>>>>>
>>>>>>
>>>>>> On Mon, Nov 17, 2008 at 5:44 PM, [EMAIL PROTECTED] <
>>>>>> [EMAIL PROTECTED]> wrote:
>>>>>>
>>>>>>>
>>>>>>> HI ,
>>>>>>>
>>>>>>> I am creating columns dynamically into Advanced Datagrid and
>>>>>>> rendering Checboxes in each cell of each column.
>>>>>>>
>>>>>>> The problem i am facing is when i scroll the advanced datagrid the
>>>>>>> values of checkboxes which are checked are changing.
>>>>>>>
>>>>>>> Please i m stuck with this part ..... Kindly help me out ASAP.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Warm Regards,
>>> Sathish Kumar T
>>>
>>>
>>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---