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/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000608.html
--- In [email protected], "djbrown_rotonews"
<[EMAIL PROTECTED]> 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 [email protected], "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 [email protected], "djbrown_rotonews"
> > <djbrown_rotonews@> wrote:
> > >
> > > bump. any help?
> > >
> > > --- In [email protected], "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 [email protected], "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
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

