ListPresenter Default view - View not update on model change

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ListPresenter Default view - View not update on model change

Günther Schmidt
Hi,

I show a list of items in a default view List Presenter, in particular,
the list shows the 'name' aspect of the item model.

Through a context menu I can change the item, and when I do so the view
isn't updated.

The item list is a "ListModel on: OrderedCollection new".

The funny thing is, that when I use a Multi column list presenter and
alter a model item the view immediately shows the change.

1.Does the ListPresenter.Default view simply not provide this functionality

or

2. do I need to make the item model trigger changed events to dependent
views?

Thanks

Günther


Reply | Threaded
Open this post in threaded view
|

Re: ListPresenter Default view - View not update on model change

Louis Sumberg-3
> Through a context menu I can change the item, and when I do so the view
> isn't updated.

I think the event notification is there, but it depends on how you are
changing the item in your menu method.  It might be that with the listbox
you are changing an aspect of an item in the model as opposed to changing an
item in the model.  With a listview you are probably using the
getContentsBlock to access the name aspect.  For example,

obj1 := #(1 'one').
obj2 := #(2 'two').
shell := ListPresenter showOn: (ListModel with: obj1 with: obj2).
shell model at: 1 put: #(3 'three').
obj2 at: 2 put: 'two again'.

Note that the fourth line is updated immediately in the view.  The last line
won't update unless you do shell view refreshContents (which also resets the
selection, if any).  Hope this helps.

-- Louis


Reply | Threaded
Open this post in threaded view
|

Re: ListPresenter Default view - View not update on model change

Ian Bartholomew-19
> Note that the fourth line is updated immediately in the view.  The last
> line
> won't update unless you do shell view refreshContents (which also resets
> the
> selection, if any).  Hope this helps.

To avoid the full refresh you can also just update the one item

shell model updateAtIndex: 2


--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.