You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by MYoung <cl...@live.com> on 2008/02/24 03:43:37 UTC
DataTable: how to make a column showing the row number?
Like the first column here, just whatever the row's number is:
+--------+-----------------+
| No. | Names |
+--------+-----------------+
| 1 | AAAAAAA |
+--------+-----------------+
| 2 | AAAAAAA |
+--------+-----------------+
| 3 | AAAAAAA |
+--------+-----------------+
| 4 | AAAAAAA |
+--------+-----------------+
| 5 | AAAAAAA |
+--------+-----------------+
| 6 | AAAAAAA |
+--------+-----------------+
| 7 | AAAAAAA |
+--------+-----------------+
| 8 | AAAAAAA |
+--------+-----------------+
I can't find a way to determine the row number in
AbstractColumn.populateItem:
columnOne = new AbstractColumn() {
public void populateItem(Item cell, String compId, IModel rowModel) {
int whatIsMyRowNumber????
cell.add(new Label(compId, whatIsMyRowNumber????);
}
};
columnTwo = ....
--
View this message in context: http://www.nabble.com/DataTable%3A-how-to-make-a-column-showing-the-row-number--tp15660105p15660105.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DataTable: how to make a column showing the row number?
Posted by MYoung <cl...@live.com>.
igor.vaynberg wrote:
>
> ...item.getparent()
>
I tried it and gives me a RepeatingView, not a Item.
igor.vaynberg wrote:
>
> public void populateItem(Item cell, String compId, IModel rowModel) {
> item.getindex() is cell, ((item)item.getparent()).getindex() is row
>
> -igor
>
>
> On Sat, Feb 23, 2008 at 6:43 PM, MYoung <cl...@live.com> wrote:
>>
>> Like the first column here, just whatever the row's number is:
>>
>> +--------+-----------------+
>> | No. | Names |
>> +--------+-----------------+
>> | 1 | AAAAAAA |
>> +--------+-----------------+
>> | 2 | AAAAAAA |
>> +--------+-----------------+
>> | 3 | AAAAAAA |
>> +--------+-----------------+
>> | 4 | AAAAAAA |
>> +--------+-----------------+
>> | 5 | AAAAAAA |
>> +--------+-----------------+
>> | 6 | AAAAAAA |
>> +--------+-----------------+
>> | 7 | AAAAAAA |
>> +--------+-----------------+
>> | 8 | AAAAAAA |
>> +--------+-----------------+
>>
>> I can't find a way to determine the row number in
>> AbstractColumn.populateItem:
>>
>> columnOne = new AbstractColumn() {
>> public void populateItem(Item cell, String compId, IModel rowModel) {
>> int whatIsMyRowNumber????
>> cell.add(new Label(compId, whatIsMyRowNumber????);
>> }
>> };
>>
>> columnTwo = ....
>>
>> --
>> View this message in context:
>> http://www.nabble.com/DataTable%3A-how-to-make-a-column-showing-the-row-number--tp15660105p15660105.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/DataTable%3A-how-to-make-a-column-showing-the-row-number--tp15660105p15660310.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DataTable: how to make a column showing the row number?
Posted by MYoung <cl...@live.com>.
Ok, I got it.
item.getParent() is a RepeatingView
item.getParent().getParent() is the row's Item. So
((Item)item.getParent().getParent()).getIndex()
gives me the answer.
Thanks!
igor.vaynberg wrote:
>
> public void populateItem(Item cell, String compId, IModel rowModel) {
> item.getindex() is cell, ((item)item.getparent()).getindex() is row
>
> -igor
>
>
> On Sat, Feb 23, 2008 at 6:43 PM, MYoung <cl...@live.com> wrote:
>>
>> Like the first column here, just whatever the row's number is:
>>
>> +--------+-----------------+
>> | No. | Names |
>> +--------+-----------------+
>> | 1 | AAAAAAA |
>> +--------+-----------------+
>> | 2 | AAAAAAA |
>> +--------+-----------------+
>> | 3 | AAAAAAA |
>> +--------+-----------------+
>> | 4 | AAAAAAA |
>> +--------+-----------------+
>> | 5 | AAAAAAA |
>> +--------+-----------------+
>> | 6 | AAAAAAA |
>> +--------+-----------------+
>> | 7 | AAAAAAA |
>> +--------+-----------------+
>> | 8 | AAAAAAA |
>> +--------+-----------------+
>>
>> I can't find a way to determine the row number in
>> AbstractColumn.populateItem:
>>
>> columnOne = new AbstractColumn() {
>> public void populateItem(Item cell, String compId, IModel rowModel) {
>> int whatIsMyRowNumber????
>> cell.add(new Label(compId, whatIsMyRowNumber????);
>> }
>> };
>>
>> columnTwo = ....
>>
>> --
>> View this message in context:
>> http://www.nabble.com/DataTable%3A-how-to-make-a-column-showing-the-row-number--tp15660105p15660105.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/DataTable%3A-how-to-make-a-column-showing-the-row-number--tp15660105p15660521.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DataTable: how to make a column showing the row number?
Posted by Igor Vaynberg <ig...@gmail.com>.
public void populateItem(Item cell, String compId, IModel rowModel) {
item.getindex() is cell, ((item)item.getparent()).getindex() is row
-igor
On Sat, Feb 23, 2008 at 6:43 PM, MYoung <cl...@live.com> wrote:
>
> Like the first column here, just whatever the row's number is:
>
> +--------+-----------------+
> | No. | Names |
> +--------+-----------------+
> | 1 | AAAAAAA |
> +--------+-----------------+
> | 2 | AAAAAAA |
> +--------+-----------------+
> | 3 | AAAAAAA |
> +--------+-----------------+
> | 4 | AAAAAAA |
> +--------+-----------------+
> | 5 | AAAAAAA |
> +--------+-----------------+
> | 6 | AAAAAAA |
> +--------+-----------------+
> | 7 | AAAAAAA |
> +--------+-----------------+
> | 8 | AAAAAAA |
> +--------+-----------------+
>
> I can't find a way to determine the row number in
> AbstractColumn.populateItem:
>
> columnOne = new AbstractColumn() {
> public void populateItem(Item cell, String compId, IModel rowModel) {
> int whatIsMyRowNumber????
> cell.add(new Label(compId, whatIsMyRowNumber????);
> }
> };
>
> columnTwo = ....
>
> --
> View this message in context: http://www.nabble.com/DataTable%3A-how-to-make-a-column-showing-the-row-number--tp15660105p15660105.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org