This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Update ListView after EditDialog problem  RSS feed

 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,
I have a ListView declared in a controller:

An Edit button whose action is linked to:

mainApp.showCategoryEditDialog receives the actual selectedCategory and the Dialog updates it as follow:

Of course setCategoryName uses the actual property (SimpleStringProperty) to update its content
Now, after closing the dialog, the focus returns to the categoryList but the content is still the old one.
If I select the same category and click edit again, the dialog shows the new (previously edited) value.
As another test I added

And the result is that the selectedCategory is added AND the categoryList is "refreshed" that is the edited value is properly displayed.
Now my expected behaviour is that updating the underlining category object should have triggered a kind of "refresh" of the categoryList.
Is my expectation wrong or am I updating the categoryList in the wrong way?
Thanks a lot for any feedback you might have!
Cheers,
zxxz

 
Giovanni De Stefano
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the answer is in using the extractor pattern as described here.

In my case I had to:

initialise the observable list as
Where the Category model contains
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!