5 Replies Latest reply on Jul 3, 2011 3:14 AM by Flex Rock

    listdata.columnIndex error

    Flex Rock Level 1


            I have a datagrid with an HeaderRenerer in it. When i tried to get the listdata.columnIndex by clicking the header in it is headerRendere page it gives only one columnIndex instead of two. But when i click on the other header it gives two columnIndex 0 and 1. Can anybody help me.





        • 1. Re: listdata.columnIndex error
          Flex harUI Adobe Employee

          I don't understand the question.

          • 2. Re: listdata.columnIndex error
            Flex Rock Level 1

            Hi ,

                   Actualy i have two datagrid columns with headerRenderer for each. When i tried to implement sort option i tried to set the selectedItem highlighted.

            My problem is when i click on one item i am getting the columnIndex as 0 and 0 instead of 0 and 1. But when i click on the other item i was able to get the index as 0 and 1. I don't know why it happens like this for one column.





            • 3. Re: listdata.columnIndex error
              Flex Rock Level 1

              Hi all,

                          No body was there in Flex team to solve this issue?





              • 4. Re: listdata.columnIndex error
                Flex harUI Adobe Employee

                I still don't understand the question.

                • 5. Re: listdata.columnIndex error
                  Flex Rock Level 1


                          In simple words i can say is i want to set the style for a headerRenderer component in Datagrid. I have custom component for headerRenderer i need to change the style whenever the headerColumn is clicked. Only the selected headerRenderer component style needs to be changed.


                  Here is my custom component.


                  <?xml version="1.0" encoding="utf-8"?>
                  <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" implements="mx.controls.listClasses.IDropInListItemRenderer">
                               import models.ModelLocator;
                               import mx.collections.SortField;
                               import mx.collections.Sort;
                               import mx.collections.ArrayCollection;
                               import mx.events.DataGridEvent;
                               import mx.controls.DataGrid;
                               import mx.controls.dataGridClasses.DataGridColumn;
                               import mx.controls.dataGridClasses.DataGridListData;
                               import mx.controls.listClasses.BaseListData;
                               import mx.controls.listClasses.IDropInListItemRenderer;
                               import utils.ValueConverters;
                               private var _data:DataGridColumn;
                               private var _listData:BaseListData;
                              override public function get data():Object {
                                  return _data;
                              override public function set data(value:Object):void {
                                  _data = value as DataGridColumn;
                              public function set listData(value:BaseListData):void {
                                  _listData = value;
                              public function get listData():BaseListData {
                                  return _listData;
                              override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
                                  super.updateDisplayList(unscaledWidth, unscaledHeight);
                                  labelContainer.styleName = HighlightDataGrid(listData.owner).sortColumnIndex == listData.columnIndex ? 'mainContainer' : 'mainContainerNo';
                                  headerlabel.text = DataGridColumn(data).headerText;
                       <mx:Canvas id="labelContainer" styleName="{HighlightDataGrid(listData.owner).sortColumnIndex == listData.columnIndex ? 'mainContainer' : 'mainContainerNo'}" toolTip="{ModelLocator.getInstance().appModel.getResourceStrng('SORT_BY') + ' ' + ValueConverters.capitalizeWordsInString(DataGridColumn(data).headerText)}"
                           backgroundAlpha="{HighlightDataGrid(listData.owner).sortColumnIndex == listData.columnIndex ? 1 : 0}">
                          <mx:Label id="headerlabel" text="{DataGridColumn(data).headerText}"/>




                  Thanks & Regards,