Anyone else with some insight here? It's getting beyond frustrating
to try and come up with a generic solution to a really
simple "problem".

--- In flexcoders@yahoogroups.com, "djbrown_rotonews"
<[EMAIL PROTECTED]> wrote:
>
> The frustrating thing? This type of functionality was available in
> Beta1.5, but has since evaporated. Note their example of
> implementing sortCompareFunction is EXACTLY what I'm wanting to do
> in Beta2 and beyond.
>
>
> --- In flexcoders@yahoogroups.com, "djbrown_rotonews"
> <djbrown_rotonews@> wrote:
> >
> > I'm with you, thinking there HAS to be a simpler way of doing
it.
> > Why we don't have access to the columnIndex, for example,
baffles
> > me. I've messed around with the whole process of over-riding
> > headerRelease and all, but it also would swap out two "rows"
when
> I
> > tried it, so I gave up and started digging deeper into this
> simpler
> > method.
> >
> > let me know if you figure this thing out.
> >
> > --- In flexcoders@yahoogroups.com, "Scott Romer" <swromer@>
wrote:
> > >
> > > I'm working on a very similar problem.  When I specify the
> > > sortCompareFunction on a DataGridColumn, it looks like it
tries
> to
> > > actually execute that function from the SortField.  Try tracing
> > > through and see for yourself...
> > >
> > > It looks like it takes the column's datafield and creates a
> > sortField
> > > for it. Then sets the sortCompareFunction from the column as
the
> > > compareFunction on the sortField.  In which case the
SortField's
> > > compare function should have a signature like this: (per doc)
> > > <code>
> > >     function myCompare(a:Object, b:Object):int
> > > </code>
> > >
> > > Hence the third parameter (fields) that we both seem to try to
> use
> > is
> > > always null?
> > >
> > > There must be a simpler way that we are just not seeing.  On a
> flip
> > > side, I'm going to try to move towards the example in their
> > documentation:
> > >
> >
>
http://livedocs.macromedia.com/labs/1/flex20beta3/wwhelp/wwhimpl/comm
> > on/html/wwhelp.htm?context=LiveDocs_Parts&file=00000608.html
> > >
> > >
> > > --- In flexcoders@yahoogroups.com, "djbrown_rotonews"
> > > <djbrown_rotonews@> wrote:
> > > >
> > > > It's default is null (obviously). Any idea how I can modify
> > > > the "call" to sortCompareFunction in the dataGridColumn line
> to
> > add
> > > > this argument to the function call?
> > > >
> > > > --- In flexcoders@yahoogroups.com, "Doug Lowder"
<douglowder@>
> > > > wrote:
> > > > >
> > > > >
> > > > > The DataGridColumn docs
> > > > >
> > > >
> >
>
<http://livedocs.macromedia.com/labs/1/flex20beta2/langref/mx/control
> > > > s/d\
> > > > > ataGridClasses/DataGridColumn.html#sortCompareFunction>  
> say
> > the
> > > > > sortCompareFunction gets passed a fields parameter in
> addition
> > to
> > > > the
> > > > > item objects being compared.  Have you checked the fields
> > > > parameter to
> > > > > see what's in it?
> > > > >
> > > > > Doug
> > > > >
> > > > >
> > > > > --- In flexcoders@yahoogroups.com, "djbrown_rotonews"
> > > > > <djbrown_rotonews@> wrote:
> > > > > >
> > > > > > bump. any help?
> > > > > >
> > > > > > --- In flexcoders@yahoogroups.com, "djbrown_rotonews"
> > > > > > djbrown_rotonews@ wrote:
> > > > > > >
> > > > > > > anyone? I've seen similir questions asked before, and
> > never
> > > > saw an
> > > > > > > answer that directly pertains to the DataGrdColumn
issue.
> > > > > > >
> > > > > > > --- In flexcoders@yahoogroups.com, "djbrown_rotonews"
> > > > > > > <djbrown_rotonews@> wrote:
> > > > > > > >
> > > > > > > > I'm using Flex Beta 2 and wanting to implement a
> generic
> > sort
> > > > > > that
> > > > > > > > will handle the approximate 20 columns I'm
displaying.
> > > > > > > >
> > > > > > > > I've got it set up as follows:
> > > > > > > > <mx:DataGridColumn id="col1" resizable="false"
> > > > > > > > textAlign="center" fontWeight="bold" headerText="STA"
> > > > > > > > width="{dgDelays.width/22}" headerWordWrap="on"
> > > > > > > dataField="acfrmsta"
> > > > > > > > labelFunction="labelFunction"
> > > > sortCompareFunction="sortAlpha"/>
> > > > > > > >
> > > > > > > > and my sortAlpha takes the form of:
> > > > > > > > public function sortAlpha(a:Object,b:Object):int {
> > > > > > > >
> > > > > > > > var field:String="acfrmsta";
> > > > > > > > var string1:String = a[field].attribute("dataValue");
> > > > > > > > var string2:String = b[field].attribute("dataValue");
> > > > > > > >
> > > > > > > > if (string1==string2)
> > > > > > > > return 0;
> > > > > > > > else if (string1 < string2)
> > > > > > > > return -1;
> > > > > > > > else
> > > > > > > > return 1;
> > > > > > > > }
> > > > > > > >
> > > > > > > > as you can see, I have to hard-code in the value of
> > arfrmsta
> > > > in
> > > > > > > the
> > > > > > > > sortalpha() method. How can I drill down and get
this
> > value
> > > > > > > > programatically if I don't have access to something
> like
> > > > > > > columnIndex
> > > > > > > > (which DOES exist apparently in DataGridListData)?
> > Either
> > > > that,
> > > > > > or
> > > > > > > I
> > > > > > > > can iterate over the column headers if something like
> > > > > > > isItemSelected
> > > > > > > > () existed.
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>







--
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