[ 
https://issues.apache.org/jira/browse/WICKET-2012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664838#action_12664838
 ] 

Juergen Donnerstag commented on WICKET-2012:
--------------------------------------------

I'm not really an expert for DataView. Looking at getRowCount() it seems that 
the row count is cached, hence the isVisibleInHierarchy() call is not there for 
performance reason. 

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

                if (isItemCountCached())
                {
                        return getCachedItemCount();
                }

Checking the call hierarchy it seems to be that depending on the row count a 
number of other activities are triggered. Retung 0 from getRowCount() seems to 
prevent that. I don't think it can be removed.


> Not possible to call getRowCount() in override of isVisible() for DataView
> --------------------------------------------------------------------------
>
>                 Key: WICKET-2012
>                 URL: https://issues.apache.org/jira/browse/WICKET-2012
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>            Reporter: Peter Thomas
>
> 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.  I could work 
> around this for now by using a separate web markup container for hiding the 
> table header row.
> My message to the mailing list: 
> http://www.nabble.com/trouble-controlling-visibility-of-dataview-td21265778.html#a21265778
> I just searched Nabble and found this had come up before:
> http://www.nabble.com/enclosures-and-dataview-td14258879.html#a14258879
> Let me know if you need a quickstart or more information.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to