You can listen to events from the collection as well.

 

dg.addEventListener(CollectionEvent.COLLECTION_CHANGE, ...)

 

Check out the doc on that event.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Greg McCreath
Sent: Sunday, March 11, 2007 8:11 PM
To: [email protected]
Subject: RE: [flexcoders] Data binding: How to detect data change has
happened?

 

Thanks Alex,

 

I'm not looking for when the dataSource is assigned, it more the second
bit of what you have mentioned: "the ICollectionView will spew events
which the DataGrid is listening for".

 

That what I am looking to hook into.  How does the dataGrid get notified
of the change to the ICollectionView and it is possible to trap it?

 

Greg.

________________________________

From: Alex Harui [mailto:[EMAIL PROTECTED] 
Sent: Monday, 12 March 2007 1:22 PM
To: [email protected]
Subject: RE: [flexcoders] Data binding: How to detect data change has
happened?

 

In the mx.controls.DataGrid, the dataProvider property is not a var, it
is a get/set function pair.  When someone assigns dataProvider, the set
function is called so we know it changed.

 

All dataProviders must implement ICollectionView or will be wrapped in
an ICollectionView.  When you change things in an ICollectionView, the
contract is the ICollectionView will spew events which the DataGrid is
listening for.

 

There is no general property watching in AS, so you have to define
contracts and use events and whatnot.

 

-Alex

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Greg McCreath
Sent: Sunday, March 11, 2007 3:36 AM
To: [email protected]
Subject: [flexcoders] Data binding: How to detect data change has
happened?

 

Hi all,

 

I'm interested to know how in an object with a data binding I can detect
a change in the datasource.

 

For example, if I were to develop (say) a custom datagrid that (in MXML)
a user of that datagrid can set the datasource property to something
like "{blah.blahblah}".

 

Then, in that custom datagrid how do I detect that that blah.blahblah
has changed and take some action when it does?  In the custom component
I do not want to know of the existence of blah.blahblah, just that it
has changed and what its new value is.

 

All help appreciated.

 

Greg.

________________________________

This email and any files transmitted with it may be confidential and are
intended solely for the use of the individual or entity to whom they are
addressed. This email may contain personal information of individuals,
and be subject to Commonwealth and/or State privacy laws in Australia.
This email is also subject to copyright. If you are not the intended
recipient, you must not read, print, store, copy, forward or use this
email for any reason, in accordance with privacy and copyright laws. If
you have received this email in error, please notify the sender by
return email, and delete this email from your inbox. 

________________________________

This email and any files transmitted with it may be confidential and are
intended solely for the use of the individual or entity to whom they are
addressed. This email may contain personal information of individuals,
and be subject to Commonwealth and/or State privacy laws in Australia.
This email is also subject to copyright. If you are not the intended
recipient, you must not read, print, store, copy, forward or use this
email for any reason, in accordance with privacy and copyright laws. If
you have received this email in error, please notify the sender by
return email, and delete this email from your inbox. 

 

Reply via email to