Search code examples
gwtjquery-mobilejsni

GWT Jquery Mobile Refresh list view


I'm adding some ListView items using AJAX in GWT.

If I call using the console in Chrome the following it works fine.

$( "#basket" ).listview( "refresh" );

If I call the following function in Java nothing happens:

public static native void refreshListView()/*-{
    $wnd.$( "#basket" ).listview( "refresh" );
}-*/;

Is there something wrong with my JSNI syntax in Java?


Solution

  • I was calling the refreshViewList before the widget was loaded properly. This works:

    item.addAttachHandler(new AttachEvent.Handler() {
    
          @Override
          public void onAttachOrDetach(AttachEvent event) {
              JQMUtil.refreshListView();
          }
        });