You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Stefan Renz <s....@efonds.com> on 2015/04/21 20:35:37 UTC

Access the row index in an AbstractColumn?

Hi,

my client asked me to implement a simple row numbering in a data table.
What I have is a Panel with a DataTable, with a varying number of
IColumns. I thought that I could add such a row number column
implementation in virtually no time, but it turns out that the index
returned by populateItem's Item argument is not the row number, but the
column number. I've been looking all around, but I can't seem to be able
to find the row number index.

Any idea how to do that in a DataTable AbstractColumn implementation?

Thanks for your help.

Bye
    Stefan


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


Re: Access the row index in an AbstractColumn?

Posted by Stefan Renz <s....@efonds.com>.
Hi Andrew,

many thanks for the pointer.

It's actually ((Item)cellItem.getParent().getParent()).getIndex() as
mentioned in the nabble thread.

I never would have guessed ;-)

Thanks again very much.

Bye,
    Stefan


Andrew Geery wrote:
> See
> http://apache-wicket.1842946.n4.nabble.com/DataTable-how-to-make-a-column-showing-the-row-number-td1855450.html
> :
> 
> public void populateItem(Item cell, String compId, IModel rowModel) {
> item.getindex() is cell, ((item)item.getparent()).getindex() is row
> 
> On Tue, Apr 21, 2015 at 2:35 PM, Stefan Renz <s....@efonds.com> wrote:
> 
>> Hi,
>>
>> my client asked me to implement a simple row numbering in a data table.
>> What I have is a Panel with a DataTable, with a varying number of
>> IColumns. I thought that I could add such a row number column
>> implementation in virtually no time, but it turns out that the index
>> returned by populateItem's Item argument is not the row number, but the
>> column number. I've been looking all around, but I can't seem to be able
>> to find the row number index.
>>
>> Any idea how to do that in a DataTable AbstractColumn implementation?
>>
>> Thanks for your help.
>>
>> Bye
>>     Stefan
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 

-- 
im Auftrag der eFonds Solutions AG, +49-89-579494-3417


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


Re: Access the row index in an AbstractColumn?

Posted by Andrew Geery <an...@gmail.com>.
See
http://apache-wicket.1842946.n4.nabble.com/DataTable-how-to-make-a-column-showing-the-row-number-td1855450.html
:

public void populateItem(Item cell, String compId, IModel rowModel) {
item.getindex() is cell, ((item)item.getparent()).getindex() is row

On Tue, Apr 21, 2015 at 2:35 PM, Stefan Renz <s....@efonds.com> wrote:

> Hi,
>
> my client asked me to implement a simple row numbering in a data table.
> What I have is a Panel with a DataTable, with a varying number of
> IColumns. I thought that I could add such a row number column
> implementation in virtually no time, but it turns out that the index
> returned by populateItem's Item argument is not the row number, but the
> column number. I've been looking all around, but I can't seem to be able
> to find the row number index.
>
> Any idea how to do that in a DataTable AbstractColumn implementation?
>
> Thanks for your help.
>
> Bye
>     Stefan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>