Hi Asma, I understood your problem and i did a POC on the same. I took it to the next level by adding a checkbox header renderer now the thing is as soon as you click on the checkbox the datagridcolumns sort function is called and due to which it is sorting it while setting all the checkbox in the column to true. and as far as i think if we can isolate the 2 sort and select all feature it will function properly. I am still struggling with that issue and am not able to fix it.
but as for the problem you were facing that has been solved: the limitations are that the datagrid tries to bring the selected row to the first row position but this might be 3rd or 4th row in the sorted order so might at times see that your scrollbar is midway. But as far as sorting for the selected rows is concerned its working properly. below is the code: ################################################################################ Main_application.mxml ################################################################################ <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" layout="absolute"> <mx:Script> <![CDATA[ import mx.controls.CheckBox; import flash.events.MouseEvent; private var dp:Array = [ { From: "IBM", Subject: "the BIG blue",isSelected:false}, { From: "Apple", Subject: "listen to iTunes",isSelected:false}, { From: "Adobe", Subject: "Flex.Good Silverlight.BAD!",isSelected:false}, { From: "SAP", Subject: "Improve your ERP model",isSelected:false}, { From: "Norton", Subject: "Latest Antivirus Scan",isSelected:false}, { From: "SAP1", Subject: "ERP model",isSelected:false}, { From: "Norton", Subject: "Latest Antivirus Scan",isSelected:false}, { From: "SAP1", Subject: "ERP model",isSelected:false}, { From: "Norton1", Subject: "Antivirus Scan",isSelected:false} ]; ]]> </mx:Script> <mx:DataGrid id="dg1" initialize="dg1.dataProvider = dp;" selectedIndex="0" x="280.5" y="10"> <mx:columns> <mx:DataGridColumn headerText="From" dataField="From" width="80" /> <mx:DataGridColumn headerText="Subject" dataField="Subject" width="300" /> <local:CheckBoxHeaderColumn textAlign="center" width="30" headerText=" " rendererIsEditor="true" itemRenderer="CheckBoxItemRenderer" sortable="true" dataField="isSelected"/> </mx:columns> </mx:DataGrid> </mx:Application> ############################################################################################# CheckBoxitemRendrer.as ############################################################################################# package { import flash.events.MouseEvent; import mx.controls.CheckBox; import mx.controls.DataGrid; import mx.events.FlexEvent; public class CheckBoxItemRenderer extends CheckBox { public function CheckBoxItemRenderer(){ super(); this.addEventListener(FlexEvent.CREATION_COMPLETE,handleCreationComplete); } private function handleCreationComplete(event:FlexEvent):void{ var dg:DataGrid = DataGrid(listData.owner); var column:CheckBoxHeaderColumn = dg.columns[listData.columnIndex]; column.addEventListener("click",columnHeaderClickHandler); } override protected function clickHandler(event:MouseEvent):void{ super.clickHandler(event); data.isSelected = this.selected; } private function columnHeaderClickHandler(event:MouseEvent):void { this.selected = event.target.selected; data.isSelected = selected; } } } hope it helps take care :) vx On Oct 10, 11:10 am, Asma <[EMAIL PROTECTED]> wrote: > i have'nt used it directly.i have created two classes one for header > checkbox and other for column. > ill send u the two files. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

