Monday, December 15, 2014

Listeditor reordering entry

Hi,

in my app I use a list editor, where i can  move entries up or down. The implementation is done in EditorSource like this:

public class MySource extends EditorSource<ItemEditor>{

       
@Override
       
public ItemEditor create(int index) {

           
final ItemEditor itemeditor = new ItemEditor();

            container
.insert(itemeditor, index);
     

            itemeditor
.getUpHandler().addClickHandler(new ClickHandler() {
               
@Override
               
public void onClick(ClickEvent event) {
                   
int index = container.getWidgetIndex(itemeditor);
                   
if (index > 0) {
                       
int to = index - 1;
                        // change position
                       
Collections.swap(editor.getList(), index, to);
                   
}
               
}
           
});

           //
...

           
return itemeditor;
       
}
}


While changing the item position in the list, changes made in the items editor are lost and the values are the initial listitem backed datavalues.  I tried making my ItemEditor ValueAware and propagating changes to the data object being edited - but that didn't work.

How can i keep the changes while reordering items in  the list.

Thanks in advance,
Frank

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment