You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by James Selvakumar <ja...@mcruncher.com> on 2017/03/16 03:34:50 UTC

Dynamic datatable columns (sequel)

Hi all,

I want to render a datatable with dynamically different columns based on
user input (via a DropDownChoice) over ajax.
I came across this old post
<http://apache-wicket.1842946.n4.nabble.com/Dynamic-DataTable-columns-td1856733.html>
which mentions that this feature might be available in Wicket 1.4.
Is this feature available in Wicket now?
Can someone explain me how to achieve this?

-- 
Thanks & regards
James

Re: Dynamic datatable columns (sequel)

Posted by James Selvakumar <ja...@mcruncher.com>.
Thanks Sven. That was very clear.

On Fri, Mar 17, 2017 at 3:34 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> you can just pass an empty collection of columns to dataTable:
>
>     private List<IColumn<Contact, String>> columns = new ArrayList<>();
>
>     public DataTablePage() {
>         DataTable<Contact, String> dataTable = new
> DefaultDataTable<>("table", columns, dataProvider, 8);
>         add(....);
>     }
>
>     protected void onConfigure()
>     {
>         // modify columns as needed
>         columns.clear();
>         if (...) {
>             columns.add(...);
>         }
>     }
>
> In #onConfigure() you adjust the columns as needed for each rendering -
> that's all.
>
> Sven
>
>
>
> On 17.03.2017 08:20, James Selvakumar wrote:
>
>> Hi Sven,
>>
>> I'm a bit clueless about this.
>> Could you share a little code example to help me? Thanks.
>>
>>
>> On Thu, Mar 16, 2017 at 5:03 PM, James Selvakumar <ja...@mcruncher.com>
>> wrote:
>>
>> Hi Sven,
>>>
>>> Thanks for the info. Will try that out.
>>>
>>> On Thu, Mar 16, 2017 at 4:20 PM, Sven Meier <sv...@meiers.net> wrote:
>>>
>>> Hi,
>>>>
>>>> you can just change the columns list (e.g. in #onConfigure) and
>>>> everything will work fine:
>>>>
>>>>    https://issues.apache.org/jira/browse/WICKET-4596
>>>>
>>>> Have fun
>>>> Sven
>>>>
>>>>
>>>> On 16.03.2017 04:34, James Selvakumar wrote:
>>>>
>>>> Hi all,
>>>>>
>>>>> I want to render a datatable with dynamically different columns based
>>>>> on
>>>>> user input (via a DropDownChoice) over ajax.
>>>>> I came across this old post
>>>>> <http://apache-wicket.1842946.n4.nabble.com/Dynamic-DataTabl
>>>>> e-columns-td1856733.html>
>>>>> which mentions that this feature might be available in Wicket 1.4.
>>>>> Is this feature available in Wicket now?
>>>>> Can someone explain me how to achieve this?
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>> --
>>> Thanks & regards
>>> James
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thanks & regards
James

Re: Dynamic datatable columns (sequel)

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

you can just pass an empty collection of columns to dataTable:

     private List<IColumn<Contact, String>> columns = new ArrayList<>();

     public DataTablePage() {
         DataTable<Contact, String> dataTable = new 
DefaultDataTable<>("table", columns, dataProvider, 8);
         add(....);
     }

     protected void onConfigure()
     {
         // modify columns as needed
         columns.clear();
         if (...) {
             columns.add(...);
         }
     }

In #onConfigure() you adjust the columns as needed for each rendering - 
that's all.

Sven


On 17.03.2017 08:20, James Selvakumar wrote:
> Hi Sven,
>
> I'm a bit clueless about this.
> Could you share a little code example to help me? Thanks.
>
>
> On Thu, Mar 16, 2017 at 5:03 PM, James Selvakumar <ja...@mcruncher.com>
> wrote:
>
>> Hi Sven,
>>
>> Thanks for the info. Will try that out.
>>
>> On Thu, Mar 16, 2017 at 4:20 PM, Sven Meier <sv...@meiers.net> wrote:
>>
>>> Hi,
>>>
>>> you can just change the columns list (e.g. in #onConfigure) and
>>> everything will work fine:
>>>
>>>    https://issues.apache.org/jira/browse/WICKET-4596
>>>
>>> Have fun
>>> Sven
>>>
>>>
>>> On 16.03.2017 04:34, James Selvakumar wrote:
>>>
>>>> Hi all,
>>>>
>>>> I want to render a datatable with dynamically different columns based on
>>>> user input (via a DropDownChoice) over ajax.
>>>> I came across this old post
>>>> <http://apache-wicket.1842946.n4.nabble.com/Dynamic-DataTabl
>>>> e-columns-td1856733.html>
>>>> which mentions that this feature might be available in Wicket 1.4.
>>>> Is this feature available in Wicket now?
>>>> Can someone explain me how to achieve this?
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> --
>> Thanks & regards
>> James
>>
>
>


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


Re: Dynamic datatable columns (sequel)

Posted by James Selvakumar <ja...@mcruncher.com>.
Hi Sven,

I'm a bit clueless about this.
Could you share a little code example to help me? Thanks.


On Thu, Mar 16, 2017 at 5:03 PM, James Selvakumar <ja...@mcruncher.com>
wrote:

> Hi Sven,
>
> Thanks for the info. Will try that out.
>
> On Thu, Mar 16, 2017 at 4:20 PM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hi,
>>
>> you can just change the columns list (e.g. in #onConfigure) and
>> everything will work fine:
>>
>>   https://issues.apache.org/jira/browse/WICKET-4596
>>
>> Have fun
>> Sven
>>
>>
>> On 16.03.2017 04:34, James Selvakumar wrote:
>>
>>> Hi all,
>>>
>>> I want to render a datatable with dynamically different columns based on
>>> user input (via a DropDownChoice) over ajax.
>>> I came across this old post
>>> <http://apache-wicket.1842946.n4.nabble.com/Dynamic-DataTabl
>>> e-columns-td1856733.html>
>>> which mentions that this feature might be available in Wicket 1.4.
>>> Is this feature available in Wicket now?
>>> Can someone explain me how to achieve this?
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Thanks & regards
> James
>



-- 
Thanks & regards
James

Re: Dynamic datatable columns (sequel)

Posted by James Selvakumar <ja...@mcruncher.com>.
Hi Sven,

Thanks for the info. Will try that out.

On Thu, Mar 16, 2017 at 4:20 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> you can just change the columns list (e.g. in #onConfigure) and everything
> will work fine:
>
>   https://issues.apache.org/jira/browse/WICKET-4596
>
> Have fun
> Sven
>
>
> On 16.03.2017 04:34, James Selvakumar wrote:
>
>> Hi all,
>>
>> I want to render a datatable with dynamically different columns based on
>> user input (via a DropDownChoice) over ajax.
>> I came across this old post
>> <http://apache-wicket.1842946.n4.nabble.com/Dynamic-DataTabl
>> e-columns-td1856733.html>
>> which mentions that this feature might be available in Wicket 1.4.
>> Is this feature available in Wicket now?
>> Can someone explain me how to achieve this?
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thanks & regards
James

Re: Dynamic datatable columns (sequel)

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

you can just change the columns list (e.g. in #onConfigure) and 
everything will work fine:

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

Have fun
Sven


On 16.03.2017 04:34, James Selvakumar wrote:
> Hi all,
>
> I want to render a datatable with dynamically different columns based on
> user input (via a DropDownChoice) over ajax.
> I came across this old post
> <http://apache-wicket.1842946.n4.nabble.com/Dynamic-DataTable-columns-td1856733.html>
> which mentions that this feature might be available in Wicket 1.4.
> Is this feature available in Wicket now?
> Can someone explain me how to achieve this?
>


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