You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Илья Нарыжный <ph...@ydn.ru> on 2015/08/15 23:36:30 UTC

Problem with paged datatable and model

Guys,

Please help to resolve the following problem. There is datatable with
paging. Table propagated from LoadableDetachableModel. Also table is under
form and contain action (AjaxFormSubmitLink) to remove a row within table.

Problem: load() on the model invoked before actual action performed due to
invoking isEnabled on AjaxPagebleLink in method Form.hasError(). So model
loaded before actual changing of underlying layer.

For me it looks like an issue in wicket.
There are not so good work arounds: detach model after action or do not use
LoadableDetachableModel.

What can you suggest?
----------------
Thanks,
Founder of Modern Data Warehouse: Orienteer
Ilia Naryzhnyy

Re: Problem with paged datatable and model

Posted by Sven Meier <sv...@meiers.net>.
Hi Ilia,

multiple calls to #size() were discussed in this issue already:

     https://issues.apache.org/jira/browse/WICKET-1766

Sven


On 20.08.2015 01:40, Илья Нарыжный wrote:
> Sven,
>
> That's actually done:) I know this problem.
> The problem for this particular case is in another place: ajax paging
> links needs to know size of IDataProvider's data. And actually wicket
> AjaxPagingLink invokes prover and corresponding model for that. So, I
> mean, all ways to optimize bahaviour leads to wicket code...
>
> Thanks,
>
> Ilia
>
> 2015-08-19 7:47 GMT-07:00 Sven Meier <sv...@meiers.net>:
>> Hi,
>>
>>> in complex apps enable and visiblity can be linked with security settings
>>> and so on
>> this is why you should override #onConfigure() and call #setEnabled() and
>> #setVisible() from there.
>>
>> Have fun
>> Sven
>>
>>
>>
>> On 19.08.2015 06:19, Илья Нарыжный wrote:
>>> Sven,
>>>
>>> Thanks! In my case IDataProvider provides data from DB. And these
>>> options leads to double query to DB... And that's a little bit
>>> redundant...
>>> DataProvider:
>>>
>>> https://github.com/OrienteerDW/wicket-orientdb/blob/master/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryDataProvider.java
>>>
>>> Do Wicket really need check enabling on every component within
>>> hasError() method? Maybe somehow mark those components which can have
>>> messages on it? Or as a workaround: check messages first and only
>>> after that check for enable and visibility? I think, that it will be
>>> even more time efficient: in complex apps enable and visiblity can be
>>> linked with security settings and so on - so for first time it might
>>> be time consuming.
>>>
>>> Thanks,
>>>
>>> Ilia
>>>
>>> 2015-08-16 1:41 GMT-07:00 Sven Meier <sv...@meiers.net>:
>>>> Hi,
>>>>
>>>> actually this is a known case where you have to call #detach() on your
>>>> model
>>>> by yourself:
>>>>
>>>>     onClick() {
>>>>       service.delete(rowModel.getObject());
>>>>
>>>>       // let model reload the items
>>>>       tableModel.detach();
>>>>     }
>>>>
>>>> Alternatively you can change IDataProvider#model() to provide a model,
>>>> which
>>>> can load a single item without loading the whole list of items first.
>>>>
>>>> Have fun
>>>> Sven
>>>>
>>>>
>>>>
>>>> On 15.08.2015 23:36, Илья Нарыжный wrote:
>>>>> Guys,
>>>>>
>>>>> Please help to resolve the following problem. There is datatable with
>>>>> paging. Table propagated from LoadableDetachableModel. Also table is
>>>>> under
>>>>> form and contain action (AjaxFormSubmitLink) to remove a row within
>>>>> table.
>>>>>
>>>>> Problem: load() on the model invoked before actual action performed due
>>>>> to
>>>>> invoking isEnabled on AjaxPagebleLink in method Form.hasError(). So
>>>>> model
>>>>> loaded before actual changing of underlying layer.
>>>>>
>>>>> For me it looks like an issue in wicket.
>>>>> There are not so good work arounds: detach model after action or do not
>>>>> use
>>>>> LoadableDetachableModel.
>>>>>
>>>>> What can you suggest?
>>>>> ----------------
>>>>> Thanks,
>>>>> Founder of Modern Data Warehouse: Orienteer
>>>>> Ilia Naryzhnyy
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with paged datatable and model

Posted by Илья Нарыжный <ph...@ydn.ru>.
Sven,

That's actually done:) I know this problem.
The problem for this particular case is in another place: ajax paging
links needs to know size of IDataProvider's data. And actually wicket
AjaxPagingLink invokes prover and corresponding model for that. So, I
mean, all ways to optimize bahaviour leads to wicket code...

Thanks,

Ilia

2015-08-19 7:47 GMT-07:00 Sven Meier <sv...@meiers.net>:
> Hi,
>
>> in complex apps enable and visiblity can be linked with security settings
>> and so on
>
> this is why you should override #onConfigure() and call #setEnabled() and
> #setVisible() from there.
>
> Have fun
> Sven
>
>
>
> On 19.08.2015 06:19, Илья Нарыжный wrote:
>>
>> Sven,
>>
>> Thanks! In my case IDataProvider provides data from DB. And these
>> options leads to double query to DB... And that's a little bit
>> redundant...
>> DataProvider:
>>
>> https://github.com/OrienteerDW/wicket-orientdb/blob/master/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryDataProvider.java
>>
>> Do Wicket really need check enabling on every component within
>> hasError() method? Maybe somehow mark those components which can have
>> messages on it? Or as a workaround: check messages first and only
>> after that check for enable and visibility? I think, that it will be
>> even more time efficient: in complex apps enable and visiblity can be
>> linked with security settings and so on - so for first time it might
>> be time consuming.
>>
>> Thanks,
>>
>> Ilia
>>
>> 2015-08-16 1:41 GMT-07:00 Sven Meier <sv...@meiers.net>:
>>>
>>> Hi,
>>>
>>> actually this is a known case where you have to call #detach() on your
>>> model
>>> by yourself:
>>>
>>>    onClick() {
>>>      service.delete(rowModel.getObject());
>>>
>>>      // let model reload the items
>>>      tableModel.detach();
>>>    }
>>>
>>> Alternatively you can change IDataProvider#model() to provide a model,
>>> which
>>> can load a single item without loading the whole list of items first.
>>>
>>> Have fun
>>> Sven
>>>
>>>
>>>
>>> On 15.08.2015 23:36, Илья Нарыжный wrote:
>>>>
>>>> Guys,
>>>>
>>>> Please help to resolve the following problem. There is datatable with
>>>> paging. Table propagated from LoadableDetachableModel. Also table is
>>>> under
>>>> form and contain action (AjaxFormSubmitLink) to remove a row within
>>>> table.
>>>>
>>>> Problem: load() on the model invoked before actual action performed due
>>>> to
>>>> invoking isEnabled on AjaxPagebleLink in method Form.hasError(). So
>>>> model
>>>> loaded before actual changing of underlying layer.
>>>>
>>>> For me it looks like an issue in wicket.
>>>> There are not so good work arounds: detach model after action or do not
>>>> use
>>>> LoadableDetachableModel.
>>>>
>>>> What can you suggest?
>>>> ----------------
>>>> Thanks,
>>>> Founder of Modern Data Warehouse: Orienteer
>>>> Ilia Naryzhnyy
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with paged datatable and model

Posted by Sven Meier <sv...@meiers.net>.
Hi,

 > in complex apps enable and visiblity can be linked with security 
settings and so on

this is why you should override #onConfigure() and call #setEnabled() 
and #setVisible() from there.

Have fun
Sven


On 19.08.2015 06:19, Илья Нарыжный wrote:
> Sven,
>
> Thanks! In my case IDataProvider provides data from DB. And these
> options leads to double query to DB... And that's a little bit
> redundant...
> DataProvider:
> https://github.com/OrienteerDW/wicket-orientdb/blob/master/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryDataProvider.java
>
> Do Wicket really need check enabling on every component within
> hasError() method? Maybe somehow mark those components which can have
> messages on it? Or as a workaround: check messages first and only
> after that check for enable and visibility? I think, that it will be
> even more time efficient: in complex apps enable and visiblity can be
> linked with security settings and so on - so for first time it might
> be time consuming.
>
> Thanks,
>
> Ilia
>
> 2015-08-16 1:41 GMT-07:00 Sven Meier <sv...@meiers.net>:
>> Hi,
>>
>> actually this is a known case where you have to call #detach() on your model
>> by yourself:
>>
>>    onClick() {
>>      service.delete(rowModel.getObject());
>>
>>      // let model reload the items
>>      tableModel.detach();
>>    }
>>
>> Alternatively you can change IDataProvider#model() to provide a model, which
>> can load a single item without loading the whole list of items first.
>>
>> Have fun
>> Sven
>>
>>
>>
>> On 15.08.2015 23:36, Илья Нарыжный wrote:
>>> Guys,
>>>
>>> Please help to resolve the following problem. There is datatable with
>>> paging. Table propagated from LoadableDetachableModel. Also table is under
>>> form and contain action (AjaxFormSubmitLink) to remove a row within table.
>>>
>>> Problem: load() on the model invoked before actual action performed due to
>>> invoking isEnabled on AjaxPagebleLink in method Form.hasError(). So model
>>> loaded before actual changing of underlying layer.
>>>
>>> For me it looks like an issue in wicket.
>>> There are not so good work arounds: detach model after action or do not
>>> use
>>> LoadableDetachableModel.
>>>
>>> What can you suggest?
>>> ----------------
>>> Thanks,
>>> Founder of Modern Data Warehouse: Orienteer
>>> Ilia Naryzhnyy
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with paged datatable and model

Posted by Илья Нарыжный <ph...@ydn.ru>.
Sven,

Thanks! In my case IDataProvider provides data from DB. And these
options leads to double query to DB... And that's a little bit
redundant...
DataProvider:
https://github.com/OrienteerDW/wicket-orientdb/blob/master/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryDataProvider.java

Do Wicket really need check enabling on every component within
hasError() method? Maybe somehow mark those components which can have
messages on it? Or as a workaround: check messages first and only
after that check for enable and visibility? I think, that it will be
even more time efficient: in complex apps enable and visiblity can be
linked with security settings and so on - so for first time it might
be time consuming.

Thanks,

Ilia

2015-08-16 1:41 GMT-07:00 Sven Meier <sv...@meiers.net>:
> Hi,
>
> actually this is a known case where you have to call #detach() on your model
> by yourself:
>
>   onClick() {
>     service.delete(rowModel.getObject());
>
>     // let model reload the items
>     tableModel.detach();
>   }
>
> Alternatively you can change IDataProvider#model() to provide a model, which
> can load a single item without loading the whole list of items first.
>
> Have fun
> Sven
>
>
>
> On 15.08.2015 23:36, Илья Нарыжный wrote:
>>
>> Guys,
>>
>> Please help to resolve the following problem. There is datatable with
>> paging. Table propagated from LoadableDetachableModel. Also table is under
>> form and contain action (AjaxFormSubmitLink) to remove a row within table.
>>
>> Problem: load() on the model invoked before actual action performed due to
>> invoking isEnabled on AjaxPagebleLink in method Form.hasError(). So model
>> loaded before actual changing of underlying layer.
>>
>> For me it looks like an issue in wicket.
>> There are not so good work arounds: detach model after action or do not
>> use
>> LoadableDetachableModel.
>>
>> What can you suggest?
>> ----------------
>> Thanks,
>> Founder of Modern Data Warehouse: Orienteer
>> Ilia Naryzhnyy
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with paged datatable and model

Posted by Sven Meier <sv...@meiers.net>.
Hi,

actually this is a known case where you have to call #detach() on your 
model by yourself:

   onClick() {
     service.delete(rowModel.getObject());

     // let model reload the items
     tableModel.detach();
   }

Alternatively you can change IDataProvider#model() to provide a model, 
which can load a single item without loading the whole list of items first.

Have fun
Sven


On 15.08.2015 23:36, Илья Нарыжный wrote:
> Guys,
>
> Please help to resolve the following problem. There is datatable with
> paging. Table propagated from LoadableDetachableModel. Also table is under
> form and contain action (AjaxFormSubmitLink) to remove a row within table.
>
> Problem: load() on the model invoked before actual action performed due to
> invoking isEnabled on AjaxPagebleLink in method Form.hasError(). So model
> loaded before actual changing of underlying layer.
>
> For me it looks like an issue in wicket.
> There are not so good work arounds: detach model after action or do not use
> LoadableDetachableModel.
>
> What can you suggest?
> ----------------
> Thanks,
> Founder of Modern Data Warehouse: Orienteer
> Ilia Naryzhnyy
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org