You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Peter Thomas <pt...@gmail.com> on 2009/01/03 16:16:49 UTC

trouble controlling visibility of dataview

Hi,

I am using a DataView and I was trying to override isVisible() and use
"this.getRowCount()" to decide if the table should be rendered or not.  But
this results in a stack overflow because DataView#getRowCount() internally
calls isVisibleInHierarchy().

The use case is trying to hide a table header row when there are no search
results.  The implementation of getRowCount() in AbstractPageableView
(Wicket 1.3.5) starts like this:

        if (!isVisibleInHierarchy())
        {
            return 0;
        }

Was wondering - is that part really necessary?  I wanted to use an enclosure
but that also results in isVisible() calls all over the place.  The only way
I could work around this for now is by using a separate web markup container
for hiding the table header row.

How can I hide a DataView if the data size is zero?  I could call size() on
the IDataProvider but I think the DataView has some logic to cache the
size.  What am I missing?

Thanks,

Peter.

Re: trouble controlling visibility of dataview

Posted by Peter Thomas <pt...@gmail.com>.
On Thu, Jan 8, 2009 at 9:34 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> override onbeforerender, do some check there, and call setvisible()
>
> -igor


Thanks Igor, I will try that.


>
>
> On Thu, Jan 8, 2009 at 5:47 AM, Peter Thomas <pt...@gmail.com> wrote:
> > On Sat, Jan 3, 2009 at 8:46 PM, Peter Thomas <pt...@gmail.com>
> wrote:
> >
> >> Hi,
> >>
> >> I am using a DataView and I was trying to override isVisible() and use
> >> "this.getRowCount()" to decide if the table should be rendered or not.
>  But
> >> this results in a stack overflow because DataView#getRowCount()
> internally
> >> calls isVisibleInHierarchy().
> >
> >
> > *bump* - I just found through a Nabble search that this had come up
> earlier:
> >
> > http://www.nabble.com/enclosures-and-dataview-td14258879.html#a14258879
> >
> > I just raised a JIRA issue:
> > https://issues.apache.org/jira/browse/WICKET-2012
> >
> >
> >>
> >>
> >> The use case is trying to hide a table header row when there are no
> search
> >> results.  The implementation of getRowCount() in AbstractPageableView
> >> (Wicket 1.3.5) starts like this:
> >>
> >>         if (!isVisibleInHierarchy())
> >>         {
> >>             return 0;
> >>         }
> >>
> >> Was wondering - is that part really necessary?  I wanted to use an
> >> enclosure but that also results in isVisible() calls all over the place.
> >> The only way I could work around this for now is by using a separate web
> >> markup container for hiding the table header row.
> >>
> >> How can I hide a DataView if the data size is zero?  I could call size()
> on
> >> the IDataProvider but I think the DataView has some logic to cache the
> >> size.  What am I missing?
> >>
> >> Thanks,
> >>
> >> Peter.
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: trouble controlling visibility of dataview

Posted by Igor Vaynberg <ig...@gmail.com>.
override onbeforerender, do some check there, and call setvisible()

-igor

On Thu, Jan 8, 2009 at 5:47 AM, Peter Thomas <pt...@gmail.com> wrote:
> On Sat, Jan 3, 2009 at 8:46 PM, Peter Thomas <pt...@gmail.com> wrote:
>
>> Hi,
>>
>> I am using a DataView and I was trying to override isVisible() and use
>> "this.getRowCount()" to decide if the table should be rendered or not.  But
>> this results in a stack overflow because DataView#getRowCount() internally
>> calls isVisibleInHierarchy().
>
>
> *bump* - I just found through a Nabble search that this had come up earlier:
>
> http://www.nabble.com/enclosures-and-dataview-td14258879.html#a14258879
>
> I just raised a JIRA issue:
> https://issues.apache.org/jira/browse/WICKET-2012
>
>
>>
>>
>> The use case is trying to hide a table header row when there are no search
>> results.  The implementation of getRowCount() in AbstractPageableView
>> (Wicket 1.3.5) starts like this:
>>
>>         if (!isVisibleInHierarchy())
>>         {
>>             return 0;
>>         }
>>
>> Was wondering - is that part really necessary?  I wanted to use an
>> enclosure but that also results in isVisible() calls all over the place.
>> The only way I could work around this for now is by using a separate web
>> markup container for hiding the table header row.
>>
>> How can I hide a DataView if the data size is zero?  I could call size() on
>> the IDataProvider but I think the DataView has some logic to cache the
>> size.  What am I missing?
>>
>> Thanks,
>>
>> Peter.
>>
>

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


Re: trouble controlling visibility of dataview

Posted by Peter Thomas <pt...@gmail.com>.
On Sat, Jan 3, 2009 at 8:46 PM, Peter Thomas <pt...@gmail.com> wrote:

> Hi,
>
> I am using a DataView and I was trying to override isVisible() and use
> "this.getRowCount()" to decide if the table should be rendered or not.  But
> this results in a stack overflow because DataView#getRowCount() internally
> calls isVisibleInHierarchy().


*bump* - I just found through a Nabble search that this had come up earlier:

http://www.nabble.com/enclosures-and-dataview-td14258879.html#a14258879

I just raised a JIRA issue:
https://issues.apache.org/jira/browse/WICKET-2012


>
>
> The use case is trying to hide a table header row when there are no search
> results.  The implementation of getRowCount() in AbstractPageableView
> (Wicket 1.3.5) starts like this:
>
>         if (!isVisibleInHierarchy())
>         {
>             return 0;
>         }
>
> Was wondering - is that part really necessary?  I wanted to use an
> enclosure but that also results in isVisible() calls all over the place.
> The only way I could work around this for now is by using a separate web
> markup container for hiding the table header row.
>
> How can I hide a DataView if the data size is zero?  I could call size() on
> the IDataProvider but I think the DataView has some logic to cache the
> size.  What am I missing?
>
> Thanks,
>
> Peter.
>