Bug 323799 - [DataBinding] Binding to single entry in List<?>
Summary: [DataBinding] Binding to single entry in List<?>
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-27 05:34 EDT by redzack81 CLA
Modified: 2013-05-27 10:32 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description redzack81 CLA 2010-08-27 05:34:51 EDT
Add support to bind against single list entries.

Model example:
class Person {
     List<String> hobbies;
}

There should be a way to bind against a single hobby from this list.
Comment 1 chengdong Mising name CLA 2010-09-15 16:39:54 EDT
Just want to clarify: It would be nice if given the Person object, we can observe (for example) the nth hobby.
Comment 2 Matthew Hall CLA 2010-09-23 00:12:36 EDT
So something like this?

  IObservableList list = ...
  IObservableValue item4 = Observables.observeListElement(list, 4)

We could possibly also allow using an IObservableValue to control which index to get at.

Is this what you're looking for?
Comment 3 redzack81 CLA 2010-09-24 08:06:42 EDT
Yes. That's what I'm looking for.

What about modifications to the list after the creation of the IObservableValue for the item? Would this be solved by also having the index as an IObservableValue?
Comment 4 Thomas Schindl CLA 2011-09-14 10:43:06 EDT
EMF-Databinding introduced support for this using the properties-API but we are not forcing a specific index but pass a callback which calculates the index to observe
Comment 5 Matthew Hall CLA 2011-09-14 10:54:29 EDT
See also bug 300043 which had a ListReducers proposal of which one of the reducers was to use the element at the nth index. This is potentially more generically applicable.
Comment 6 Thomas Schindl CLA 2011-09-14 11:26:41 EDT
(In reply to comment #5)
> See also bug 300043 which had a ListReducers proposal of which one of the
> reducers was to use the element at the nth index. This is potentially more
> generically applicable.

Yeah this one looks very similar to ours but ours has the difference that we also allow to write back to the list.