Well thought I had it licked but not!

It works great until I make my HTTPService call to the Spring 
controller on the server to get the sorted result. Just like the sort 
arrow the underlining disappears after the service call.

I only show 20 records out of a much larger result set so when 
sorting I need to call the HTTPservice again to get the sorted subset 
after the entire resultset is sorted on the server. ERRRR!

Does anyone have a work around for this kind of behavior? What do I 
need to extend/override to keep the sort arrow or in my latest 
attempt the underlining?

Any and all help is appreciated.

Desperately,
CJ


--- In flexcoders@yahoogroups.com, "cjcuccaro" <[EMAIL PROTECTED]> wrote:
>
> I believe I got it. I use the added sortEventHandler event listener 
> to set the style textDecoration to none and the clickHandler to 
reset 
> the textDecoration to underline.
> 
>               private function sortEventHandler
> (event:DataGridEvent):void
>               {
>                       if (event.itemRenderer == this){
>                               event.preventDefault();
>                       }
>                       setStyle("textDecoration", "none"); 
>               }
>               
>               private function clickHandler(event:MouseEvent):void
>               {
>                       setStyle("textDecoration", "underline"); 
>               } 
> 
> 
> and it took me way to many hours to come to this conclusion. yikes!
> 
> Thanks for your input Alex, it is greatly appreciated.
> 
> Regards,
> CJ
> 
> --- In flexcoders@yahoogroups.com, Alex Harui <aharui@> wrote:
> >
> > I would probably test that the DataGrid
> (listData.owner).collection.sort.sortFIeld[0].name == data.dataField
> > 
> > You'll need more null checks and what not but that tests to see 
if 
> the sort on the collection is sorting on the same field as the 
column 
> the header renderer is displaying.
> > 
> > From: flexcoders@yahoogroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of cjcuccaro
> > Sent: Friday, September 12, 2008 8:27 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: Trying to underline datagrid header 
text. 
> How???
> > 
> > 
> > Thank you Alex for your feedback.
> > 
> > So I visited your blog read about renderers, very good info, and 
> started with your checkbox example. I changed the checkbox to a 
label 
> and have it underlining on the click but don't know how to toggle 
the 
> underline when clicking other columns. Can you or anyone provide 
any 
> suggestions on how I can achieve this? Below is the headerRenderer 
> custom class.
> > 
> > RgColHeaderLabel.as file:
> > 
> > package
> > {
> >  import mx.controls.Label;
> > 
> >  public class RgColHeaderLabel extends Label
> >  {
> > 
> >   import flash.events.MouseEvent;
> >   import mx.events.DataGridEvent;
> >   import mx.controls.DataGrid;
> >   import mx.controls.dataGridClasses.DataGridColumn;
> >   import mx.controls.dataGridClasses.DataGridListData;
> > 
> >   private var _data:DataGridColumn;
> > 
> >   public function RgColHeaderLabel()
> >   {
> >    super();
> >    addEventListener("click", clickHandler);
> >   }
> > 
> >   override public function get data():Object
> >   {
> >    return _data;
> >   }
> > 
> >   override public function set data(value:Object):void
> >   {
> >    _data = value as DataGridColumn;
> > 
> >    text = DataGridListData(listData).label ;
> >    setStyle("textAlign","center");
> >    DataGrid(listData.owner).addEventListener
> (DataGridEvent.HEADER_RELEASE, sortEventHandler);
> > 
> >   }
> > 
> >   private function sortEventHandler(event:DataGridEvent):void  {
> >    if (event.itemRenderer == this)
> >     event.preventDefault();
> >   }
> > 
> >   private function clickHandler(event:MouseEvent):void
> >   {
> >    //how do i underline only the clicked header?
> > 
> >     setStyle("textDecoration", "underline");
> >   }
> > 
> >  }
> > }
> > 
> > Below is your dg.mxml with a modification to the headerRenderer:
> > 
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
> xmlns:local="*" >
> > 
> > <mx:Script>
> > <![CDATA[
> > 
> > private var dp:Array = [
> >  { symbol: "ADBE", name: "Adobe Systems Inc.",
> >   news: "Adobe Flex is <b>great</b>! according to 
> <i>FlexCoders</i>" },
> >  { symbol: "MACR", name: "Macromedia Inc.",
> >   news: "<FONT color='#FF0000'>Macromedia</FONT> is absorbed into 
> Adobe" },
> >  { symbol: "MSFT", name: "Microsoft Corp.",
> >   news: "Microsoft sees <FONT size='20'>Flex</FONT> for the first 
> time" },
> >  { symbol: "IBM", name: "IBM Corp.",
> >   news: "IBM was once the top <b><i>dog</i></b> but no more" }
> >  ];
> > 
> > ]]>
> > </mx:Script>
> > 
> > <mx:DataGrid id="dg1" initialize="dg1.dataProvider = dp" 
> paddingTop="0" paddingBottom="0" verticalAlign="middle"
> >  variableRowHeight="true" >
> > <mx:columns>
> > <mx:DataGridColumn headerText="Name" dataField="name" width="140" 
> headerRenderer="RgColHeaderLabel"/>
> > <mx:DataGridColumn headerText="Symbol" dataField="symbol" 
> width="60" headerRenderer="RgColHeaderLabel"/>
> > <mx:DataGridColumn headerText="News" dataField="news" 
> wordWrap="true" width="200" headerRenderer="RgColHeaderLabel"/>
> > </mx:columns>
> > </mx:DataGrid>
> > 
> > </mx:Application>
> > 
> > 
> > 
> > Thanks,
> > 
> > CJ
> >
>


Reply via email to