Hello:
I have a simple search form , where some criteria refreshes the table based
on the db. I got it working with ListView, but im trying to use
ListDataProvider, I feel missing something:

class MyForm {
  List myList;
  MyDataView myDataView;
  MyDataProvider myDataProvider;

  public MyForm() {
    @Override public void onSubmit() {
       myList  = refreshData(criteria);
       //Question: How do I set this list into the myDataView or
myDataProvider ? I thought myDataView or the provider will auto pick it up,
because its a member variable and is a RefreshingView
    }

    //First time
    myList = refreshData(defaultCriteria);
    myDataView = new MyDataView("myDataView" , new MyDataProvider(myList));
    add(myListView);
  }
}


class MyDataView extends DataView {
   public MyDataView(String id, IDataProvider provider) { super(id,
provider); }

   @Override public void populateItem(Item item) { .... }
}

class MyDataProvider extends ListDataProvider {
  public MyDataProvider(List list) {
     super(list);
  }
}

I looked at the example that uses ListView
http://cwiki.apache.org/WICKET/reading-from-a-database.html
<http://cwiki.apache.org/WICKET/reading-from-a-database.html>

With ListView it works fine if I do this in the method onSubmit()

myList = refreshData(criteria);
myListView.setList(myList);

But with DataView, I do not have a set method to reset the new list obtained
based on the criteria. The db returns correct data, but the page displays
the old data (no change). Neither do I see a method to set the new list in
the ListDataProvider.

I even tried adding a new view inside the onSubmit, but that doesnt work
either:

myDataView = new MyDataView("myDataView", new MyDataProvider(newList));

-- 
Thanks!
Vasu Srinivasan

Reply via email to