Adding support for data-binding to all changes in an object graph #22

Closed
kolya-ay opened this Issue Dec 24, 2011 · 7 comments

Comments

Projects
None yet
3 participants

Do you consider to add an 'elementchange' to the ArrayObservable event types in jquery.observable.js? That "change" should be fired when an element of an Array changes its value. Please take a look how it's implemented in competitive project.

huub commented Jan 7, 2013

I am looking for the same functionality.
In my case large arrays of data are rendered by jsView; I would like to be able to detect deletions, new and changed values to post 'annotated' [deleted, new, changed] data back to the datastore.

Owner

BorisMoore commented Jan 7, 2013

Yes, this is a scenario that I hope we can address more specifically, but it will be after beta, and possibly not until after V1.0. I'll get back to it then...

Owner

BorisMoore commented Apr 9, 2013

I updated the title.

  • This request can address any scenarios of listening to all changes in an object graph, including your example of propertyChange of any item in an array. Possibly support paths such as a[*].b for changes of b on any item in array a, etc.

Currently much of it is already covered by 'deep data-linking', but I have considered also supporting listening to all changes. This will be much more chatty and memory intensive, though, so should only be added as a less performant opt-in scenario.

Owner

BorisMoore commented Jul 30, 2014

This is largely covered now by the observeAll() feature. http://www.jsviews.com/#observeAll

huub commented Jul 31, 2014

Great thanks, i'll refactor my code and try to use it. It has to work on one (or more) elements of an array of data), so i'll probably have to observe every element seperately?
eh.. we're you saying in April that
$.observe(person, "*", changeHandler);

would be exactly the same as
$.observable(person).observeAll( changeHandler);

Owner

BorisMoore commented Aug 1, 2014

$.observe(person, "*", changeHandler); will listen to changes of any property of person, e.g. setting a new person.address object or a new person.name string, or a new person.phones array - see http://www.jsviews.com/#observe. $.observable(person).observeAll( changeHandler); will listen to the above changes, but also to changes to persons.address.street, and to adding and removing phones, or changing their values. etc.

$.observable(people).observeAll( changeHandler); will listen to adding removing items to the array etc. but also changes to people[0].address.street, people[2].phones, etc.

@BorisMoore BorisMoore added Resolved and removed After V1? labels Aug 1, 2014

Owner

BorisMoore commented Aug 1, 2014

I'll close this as resolved... Let me know if it does not address your requirements...

@BorisMoore BorisMoore closed this Aug 1, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment