1

I have implemented below code for repeating view

DataView documents = new DataView("documents", dataProvider, new Long(20)) {
   @Override
   protected void populateItem(Item item) {
   //do some code
};

When I debug the code, debug point is not going inside of populateItem method, while dataprovider is having list of document and implement Idataprovider interface, so due to this there is no data is populated.

We have moved application from wicket 1.3 to 1.7 after that we are facing this problem.

I don't know why it behaves like this.

Rob Audenaerde
  • 19,195
  • 10
  • 76
  • 121
Nitin
  • 71
  • 11
  • One reason could be that the DataView itself or its parent is invisible. – martin-g Apr 23 '18 at 17:25
  • Could you please tell me flow after calling dataview constructor to populateItem(Item item). – Nitin Apr 23 '18 at 18:19
  • @martin-g How is depends on visibility of dataview itself or parent. If I am not wrong after calling constructor its will call populateoverride method. – Nitin Apr 24 '18 at 06:46
  • @martin-g I have update my question with more info. we have migrated wicket from 1.3 to 1.7 – Nitin Apr 24 '18 at 06:47
  • `populateItem()` is called at render time. This could be much later than the construction time. Once you add the dataView to a parent container (e.g. a WebPage) Wicket will call `dataView.onInitialize()`. Later when the complete component tree is fully constructed Wicket will call Page#render() and this will call #render() for all children recursively. At that time dataView.populateItem() will be called. But it will be called only if dataView.isVisible() returns true. There is no reason to populate it if it won't be rendered. – martin-g Apr 24 '18 at 08:46
  • @martin-g Yes you are correct but why debug point is not going inside of populateItem() while i have set visible is true. can you please help me. – Nitin Apr 24 '18 at 14:03
  • Maybe the dataprovider does not return any data? Put a breakpoint on it's `size()` method? – Rob Audenaerde Apr 25 '18 at 07:47
  • @martin-g RobAu : Yes, i have tried debug again and see when DataView API is calling DataProvider have data and set this data after that somehow dataprovider dont have any data and showing me that "Internal error occurred, see error log for more detail", but i didn't see any error in logs. – Nitin Apr 25 '18 at 07:52
  • In that case your logging configuration must be broken. It seems you have a runtime error in your IDataProvider impl and because of this DataView#populateItem() is not called. – martin-g Apr 25 '18 at 08:26
  • @martin-g FYI we have migrated wicket from 1.3 to 1.7 after that we are getting this problem. how to solve logging configuration issue. – Nitin Apr 25 '18 at 08:29
  • @RobAu could please provide any solution for this. – Nitin Apr 25 '18 at 09:34
  • its look like problem with `dataprovider` does not have any data . Thats the reason it doesn't come to populate. – soorapadman Apr 25 '18 at 09:48
  • Thanks all of you for your help. – Nitin Apr 25 '18 at 11:32

1 Answers1

-1

I got solution after so many debug. problem is wicket migration.

earlier we are using wicket 1.3 and in this one IDataProvider having Iterator<? extends T> iterator(int first, int count); and now wicket 1.7 changed with Iterator<? extends T> iterator(long first, long count); so we override this method with return null; value that's why we are getting null in data Provider.

Nitin
  • 71
  • 11