Hi Pradeep, 

As Ali confirmed its working for him, please check again in your code.
If it is not working, I am going to tell you other way of doing this. 

All data of DataGrid or other List components are stored in
DataProvider, so any changes or manipulation in data triggers
DataProvider's modelChanged event.

You can see DataProvider Event's API here:
http://livedocs.macromedia.com/flex/15/asdocs_en/mx/controls/listclasses
/DataProvider.html#events


Following example shows, how can you subscribe dataProvider events:


##Example1.mxml##

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
creationComplete="onAppInit();">

    <mx:Script>
        <![CDATA[
         import mx.controls.listclasses.DataProvider;
         import mx.utils.Delegate;
         
          function onAppInit()
          {
              
              //subscribe modelChanged event from DataGrid's
dataProvider
              myGrid.dataProvider.addEventListener("modelChanged",
Delegate.create(this,onDataProviderModelChanged));
          }
          
          function onDataProviderModelChanged(event)
          {
              
              
              if(event.eventName == "sort") 
              {
                alert("Sort completed");
              }
          }
          ]]>
    </mx:Script>
    
    <mx:Panel title="DataGrid Sort Event" marginTop="10">
            <mx:DataGrid id="myGrid" width="350" height="100" >
                <mx:dataProvider>
                   <mx:Array id="arr">
                        <mx:Object Artist=" Kapil" Album="All Time
Favourites" Price="10"/>
                        <mx:Object Artist=" Kapil" Album="Classic Songs"
Price="10"/>
                   </mx:Array>
                </mx:dataProvider>
            </mx:DataGrid>
    </mx:Panel>

</mx:Application>   


        

2) ##Example2.mxml##

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
creationComplete="onAppInit();">

    <mx:Script>
        <![CDATA[
         
         import mx.utils.Delegate;
         
         var dp:Array = [
                            {Artist:"Kapil", Album:"All Time
Favourites", Price:10},
                            {Artist:"Manish", Album:"Rock", Price:20}
                          ];
         
                            
         
          function onAppInit()
          {
              
              //subscribe to modelChangedEvent from dp Array.
              dp.addEventListener("modelChanged",
Delegate.create(this,onDataProviderModelChanged));
          }
          
          function onDataProviderModelChanged(event)
          {
              
              
              if(event.eventName == "sort") 
              {
                alert("Sort completed");
              }
          }
          ]]>
    </mx:Script>
    
    <mx:Panel title="DataGrid Sort Event" marginTop="10">
            <mx:DataGrid id="myGrid" width="350" height="100"
dataProvider="{dp}" >
              
            </mx:DataGrid>
    </mx:Panel>

</mx:Application>   




Hope that helps...

-abdul
        


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Pradeep
Sent: Monday, May 23, 2005 5:55 PM
To: [email protected]
Subject: [flexcoders] Operations to perform after sorting of datagrid

Hi,
I need to perform some custom operation whenever any of the columns of
datagrid is sorted. The headerRelease event is fired just before sorting
is about to occur but i want to perform operation after sorting is
done. Please suggest some alternatives.

Pradeep




 
Yahoo! Groups Links



 



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alistair McLeod
Sent: Monday, May 23, 2005 6:14 PM
To: [email protected]
Subject: RE: [flexcoders] Operations to perform after sorting of
datagrid

Hi Pradeep,

I've just knocked together a test and it certainly seems that
headerRelease
is broadcast after the sort has taken place. Can you post some code
showing
otherwise?

Cheers,

Ali 


--
Alistair McLeod
Development Director
iteration::two
[EMAIL PROTECTED]
 
Office:  +44 (0)131 338 6108
 
This e-mail and any associated attachments transmitted with it may
contain
confidential information and must not be copied, or disclosed, or used
by
anyone other than the intended recipient(s). If you are not the intended
recipient(s) please destroy this e-mail, and any copies of it,
immediately.
 
Please also note that while software systems have been used to try to
ensure
that this e-mail has been swept for viruses, iteration::two do not
accept
responsibility for any damage or loss caused in respect of any viruses
transmitted by the e-mail. Please ensure your own checks are carried out
before any attachments are opened.
 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alistair McLeod
Sent: 23 May 2005 13:35
To: [email protected]
Subject: RE: [flexcoders] Operations to perform after sorting of
datagrid

Hi Pradeep,

Are you sure the headerRelease event is broadcast before the sort has
been
completed? I thought it was afterwards.

In any case, you should be able to listen for the "modelChanged" event
on
your DataGrid's dataProvider, which will be broadcast after the sort has
completed. Specifically, the event object broadcast will have an
eventName
property set to "sort" when sorting has taken place (though I'm not sure
if
that's a documented feature).

Cheers,

Ali


--
Alistair McLeod
Development Director
iteration::two
[EMAIL PROTECTED]
 
Office:  +44 (0)131 338 6108
 
This e-mail and any associated attachments transmitted with it may
contain
confidential information and must not be copied, or disclosed, or used
by
anyone other than the intended recipient(s). If you are not the intended
recipient(s) please destroy this e-mail, and any copies of it,
immediately.
 
Please also note that while software systems have been used to try to
ensure
that this e-mail has been swept for viruses, iteration::two do not
accept
responsibility for any damage or loss caused in respect of any viruses
transmitted by the e-mail. Please ensure your own checks are carried out
before any attachments are opened.
 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Pradeep
Sent: 23 May 2005 13:25
To: [email protected]
Subject: [flexcoders] Operations to perform after sorting of datagrid

Hi,
I need to perform some custom operation whenever any of the columns of
datagrid is sorted. The headerRelease event is fired just before sorting
is
about to occur but i want to perform operation after sorting is done.
Please
suggest some alternatives.

Pradeep




 
Yahoo! Groups Links



 



 
Yahoo! Groups Links



 



 
Yahoo! Groups Links



 




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to