I'm trying to use a headerRelease in Beta2 to sort by columns in my
dataGrid. I've been able to determine via debugging that it's
only "swapping" two rows, and leaving the remaining rows in their
original order. Any idea what might be going wrong?

I have a filterFunction set up for delays_xml, and I output the
collection when initialized (as it appears in the grid before a
header click) and after (after the headerRelease) and only
two "rows" have switched places, so it's like it's only calling the
sort method once (the two "rows" have switched places in the
collection, like a swap sort would tend to do)

My relevant code:

<mx:XMLListCollection id="delays_xml"
source="{getadvisordelays.result.*}" filterFunction="filterData"/>


<mx:DataGrid width="100%" height="95%" left="0" top="30"
id="dgDelays"  dataProvider="{delays_xml}"
headerRelease="headerReleaseEvent(event,this.dgDelays)">


<mx:Script>
<![CDATA[
import mx.events.DataGridEvent;
                 
public function headerReleaseEvent(event:DataGridEvent,
grid:DataGrid):void {
  trace(" event fired on col: ",event.columnIndex);
                       
  var sortA:Sort = new Sort();
  trace( " col to sort: " , event.dataField);
  var sortAlpha:SortField= new SortField(event.dataField);
  sortA.fields=[sortAlpha];
                       
  delays_xml.sort=sortA;
  delays_xml.refresh();
                                   
  event.preventDefault();
}
]]>
</mx:Script>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to