You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by bh...@actrix.gen.nz on 2010/02/14 03:41:48 UTC

How to hide / show additional descriptive Row below empty DataView?

Hi all,

How is it possible to dynamically show and hide an additional dummy
row "No items to show" below a DataView?

I tried this with code similar to code below but it does not work even
though isVisible() is called. I have a small testcase ready to go.
It's quite basic so I must be missing something obvious.

Many thanks

Bernard


In a DataView, with an AjaxFallbackLink delete action, in onClick I do
something like

item.setVisible(false);
target.addComponent(item);
target.addComponent(emptyRow);

with emptyRow as follows:

        final WebMarkupContainer emptyRow = new
WebMarkupContainer("emptyRow"){
            @Override
            public boolean isVisible(){
                return rowProvider.size() == 0;
            }
        };
        emptyRow.setOutputMarkupId(true);
        add(emptyRow);

In HTML:

        <tr wicket:id="dataRow">
            <td wicket:id="Id">ID</td>
            <td><a wicket:id="delete">Delete</a></td>
        </tr>
        <tr wicket:id="emptyRow">
            <td colspan="2">No Items to show</td>
        </tr>


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


Re: How to hide / show additional descriptive Row below empty DataView?

Posted by vineet semwal <vi...@gmail.com>.
i meant dataprovider.size() ...

On Sun, Feb 14, 2010 at 1:12 PM, vineet semwal
<vi...@gmail.com>wrote:

> two suggestions,
> 1)emptyrow.setoutputmarkupplaceholdertag(true) instead of
> setoutputmarkupid(true).
> 2)you can use dataview.getitemscount() instead of data.size() as later can
> be expensive.
>
> On Sun, Feb 14, 2010 at 8:11 AM, <bh...@actrix.gen.nz> wrote:
>
>> Hi all,
>>
>> How is it possible to dynamically show and hide an additional dummy
>> row "No items to show" below a DataView?
>>
>> I tried this with code similar to code below but it does not work even
>> though isVisible() is called. I have a small testcase ready to go.
>> It's quite basic so I must be missing something obvious.
>>
>> Many thanks
>>
>> Bernard
>>
>>
>> In a DataView, with an AjaxFallbackLink delete action, in onClick I do
>> something like
>>
>> item.setVisible(false);
>> target.addComponent(item);
>> target.addComponent(emptyRow);
>>
>> with emptyRow as follows:
>>
>>        final WebMarkupContainer emptyRow = new
>> WebMarkupContainer("emptyRow"){
>>            @Override
>>            public boolean isVisible(){
>>                return rowProvider.size() == 0;
>>            }
>>        };
>>        emptyRow.setOutputMarkupId(true);
>>        add(emptyRow);
>>
>> In HTML:
>>
>>        <tr wicket:id="dataRow">
>>            <td wicket:id="Id">ID</td>
>>            <td><a wicket:id="delete">Delete</a></td>
>>        </tr>
>>        <tr wicket:id="emptyRow">
>>            <td colspan="2">No Items to show</td>
>>        </tr>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> regards,
> Vineet Semwal
>



-- 
regards,
Vineet Semwal

Re: How to hide / show additional descriptive Row below empty DataView?

Posted by vineet semwal <vi...@gmail.com>.
two suggestions,
1)emptyrow.setoutputmarkupplaceholdertag(true) instead of
setoutputmarkupid(true).
2)you can use dataview.getitemscount() instead of data.size() as later can
be expensive.

On Sun, Feb 14, 2010 at 8:11 AM, <bh...@actrix.gen.nz> wrote:

> Hi all,
>
> How is it possible to dynamically show and hide an additional dummy
> row "No items to show" below a DataView?
>
> I tried this with code similar to code below but it does not work even
> though isVisible() is called. I have a small testcase ready to go.
> It's quite basic so I must be missing something obvious.
>
> Many thanks
>
> Bernard
>
>
> In a DataView, with an AjaxFallbackLink delete action, in onClick I do
> something like
>
> item.setVisible(false);
> target.addComponent(item);
> target.addComponent(emptyRow);
>
> with emptyRow as follows:
>
>        final WebMarkupContainer emptyRow = new
> WebMarkupContainer("emptyRow"){
>            @Override
>            public boolean isVisible(){
>                return rowProvider.size() == 0;
>            }
>        };
>        emptyRow.setOutputMarkupId(true);
>        add(emptyRow);
>
> In HTML:
>
>        <tr wicket:id="dataRow">
>            <td wicket:id="Id">ID</td>
>            <td><a wicket:id="delete">Delete</a></td>
>        </tr>
>        <tr wicket:id="emptyRow">
>            <td colspan="2">No Items to show</td>
>        </tr>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
regards,
Vineet Semwal