Re: [flexcoders] Re: generic sorts for DataGridColumns?

2006-06-15 Thread Brendan Meutzner



I'll throw in a bump on this one I'm trying to implement this myself and am finding it just as frustrating/useless as djbrown... a little love on the topic from Adobe would be appreciated.Thanks,Brendan
P.S. Looks like this kind of died a month ago... so did you have any luck dj?On 5/16/06, djbrown_rotonews 
[EMAIL PROTECTED] wrote:Anyone else with some insight here? It's getting beyond frustrating
to try and come up with a generic solution to a reallysimple 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 doingit.  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 rowswhen 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 ittries 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 theSortField'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_Partsfile=0608.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  addthis argument to the function call?   --- In 
flexcoders@yahoogroups.com, Doug Lowderdouglowder@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  tothe item objects being compared.Have you checked the fieldsparameter 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
  neversaw an   answer that directly pertains to the DataGrdColumnissue. --- In 
flexcoders@yahoogroups.com, djbrown_rotonews   djbrown_rotonews@ wrote:   
I'm using Flex Beta 2 and wanting to implement a generic  sort  thatwill 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=STAwidth={dgDelays.width/22} headerWordWrap=on
   dataField=acfrmstalabelFunction=labelFunctionsortCompareFunction=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;elsereturn 1;}   
as you can see, I have to hard-code in the value of  arfrmstain   thesortalpha() method. How can I drill down and get
this  valueprogramatically if I don't have access to something like   columnIndex(which DOES exist apparently in DataGridListData)?
  Eitherthat,  or   Ican iterate over the column headers if something like
   isItemSelected() existed.  
   Yahoo! Groups Sponsor ~--Everything you need is oneclick away. Make Yahoo! your home pagenow.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/nhFolB/TM~---

[flexcoders] Re: generic sorts for DataGridColumns?

2006-05-16 Thread djbrown_rotonews



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_Partsfile=0608.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
  
  

[flexcoders] Re: generic sorts for DataGridColumns?

2006-05-15 Thread djbrown_rotonews



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 
[EMAIL PROTECTED] 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_Partsfile=0608.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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL 

[flexcoders] Re: generic sorts for DataGridColumns?

2006-05-12 Thread djbrown_rotonews



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 [EMAIL PROTECTED] 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_Partsfile=0608.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



  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.



  












[flexcoders] Re: generic sorts for DataGridColumns?

2006-05-11 Thread djbrown_rotonews



bump. any help?

--- In flexcoders@yahoogroups.com, djbrown_rotonews 
[EMAIL PROTECTED] 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



  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.



  












[flexcoders] Re: generic sorts for DataGridColumns?

2006-05-11 Thread Doug Lowder



The DataGridColumn docs 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" [EMAIL PROTECTED] 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  thatwill 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   thesortalpha() method. How can I drill down and get this valueprogramatically if I don't have access to something like   columnIndex(which DOES exist apparently in DataGridListData)? Either that,  or   Ican 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.



  









[flexcoders] Re: generic sorts for DataGridColumns?

2006-05-11 Thread djbrown_rotonews



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 [EMAIL PROTECTED] 
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



  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.



  











[flexcoders] Re: generic sorts for DataGridColumns?

2006-05-11 Thread Scott Romer



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/common/html/wwhelp.htm?context=LiveDocs_Partsfile=0608.html


--- In flexcoders@yahoogroups.com, 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 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



  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.