You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ernesto Reinaldo Barreiro <re...@gmail.com> on 2015/11/18 14:09:22 UTC

showing a hidden AbstractPageableView

Hi,

I have a meta-component that contains a listview that is show or hidden if
there are elements. This was working "before". The criterion I'm using to
show it is  getPageCount() > 0

@Override
public long getPageCount()
{
long total = getRowCount();
long itemsPerPage = getItemsPerPage();
long count = total / itemsPerPage;

if (itemsPerPage * count < total)
{
count++;
}

return count;

}

but

/**
* Get the row count.
*
* @see #getItemCount()
*
* @return total item count, but 0 if not visible in the hierarchy
*/
public final long getRowCount()
{
if (!isVisibleInHierarchy())
{
return 0;
}

return getItemCount();
}

So it returns 0 even if the are element on the list. Are there any changes
on ListView that might have changed this.? I could not spot anything at

https://github.com/apache/wicket/commits/master/wicket-core/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java

Of course I could cast IPageable to AbstractPageableView and call directly
getItemCount() but I wold like to avoid doing that.


-- 
Regards - Ernesto Reinaldo Barreiro

Re: showing a hidden AbstractPageableView

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
For the time being I have just overridden my DataView getPageCount as


 override def getPageCount: Long = {
        val total: Long = getItemCount
        val itemsPerPage: Long = getItemsPerPage
        var count: Long = total / itemsPerPage
        if (itemsPerPage * count < total) {
          count += 1
        }
        count
      }

On Wed, Nov 18, 2015 at 2:09 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Hi,
>
> I have a meta-component that contains a listview that is show or hidden if
> there are elements. This was working "before". The criterion I'm using to
> show it is  getPageCount() > 0
>
> @Override
> public long getPageCount()
> {
> long total = getRowCount();
> long itemsPerPage = getItemsPerPage();
> long count = total / itemsPerPage;
>
> if (itemsPerPage * count < total)
> {
> count++;
> }
>
> return count;
>
> }
>
> but
>
> /**
> * Get the row count.
> *
> * @see #getItemCount()
> *
> * @return total item count, but 0 if not visible in the hierarchy
> */
> public final long getRowCount()
> {
> if (!isVisibleInHierarchy())
> {
> return 0;
> }
>
> return getItemCount();
> }
>
> So it returns 0 even if the are element on the list. Are there any changes
> on ListView that might have changed this.? I could not spot anything at
>
>
> https://github.com/apache/wicket/commits/master/wicket-core/src/main/java/org/apache/wicket/markup/repeater/AbstractPageableView.java
>
> Of course I could cast IPageable to AbstractPageableView and call directly
> getItemCount() but I wold like to avoid doing that.
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
Regards - Ernesto Reinaldo Barreiro