0

Binded listbox doesn't synchronized even after binder.loadAll()

asked 2009-12-10 07:19:14 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

updated 2009-12-10 07:19:29 +0800

Hello,

I'm implementing a feature to delete all the selected elements of a listbox, the listbox's model is binded to a composer List:

        <listbox id="listBoxBooks" model="@{wnd$composer.booksModel}" checkmark="true" multiple="true"
                 fixedLayout="true" width="500px">
            <listhead>
                <listheader label="ID" sort="auto(id)" width="50px"/>
            </listhead>
            <listitem self="@{each=book}" value="@{book}">
                <listcell label="@{book.id}"/>
            </listitem>
        </listbox>

    <button id="btnDelete" label="Delete Selected"/>

Now on my composer I've the code to delete the selected books from the database:

    ListModel booksModel

    public void onClick$btnDelete() {
        if (listBoxBooks.selectedCount > 0) {
            // delete the books from the database
            // get the new list of books
            booksModel = new BindingListModelList(books, false)
            binder.loadAll()
        }
    }

After I delete some books the listbox isn't automatically updated I have to refresh the hole page to get the updated list of books. I've already tried to invalidate the listbox component with no luck.

How could I update the listbox after I delete some elements?


Regards

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2009-12-10 07:50:09 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

Felipe, I'm not sure, but I think it could be from the fact that you're creating a new BindingListModelList. See what happens if you try this:

   ListModel booksModel

    public void onClick$btnDelete() {
        if (listBoxBooks.selectedCount > 0) {
            // delete the books from the database
            // get the new list of books
            booksModel.clear().
            booksModel.addAll(books) ;
            binder.loadAll() ;
        }
    }

and set a breakpoint in your getBooksModel() so you can examine what books are being returned to the data binder.

HTH,

link publish delete flag offensive edit

answered 2009-12-10 08:07:14 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

Thank you cary. It solved the problem and a flush after the delete :)

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-12-10 07:19:14 +0800

Seen: 1,105 times

Last updated: Dec 10 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More