On Thu, Jun 5, 2008 at 7:55 PM, Flavius <[EMAIL PROTECTED]> wrote:
>
> I'm using a DefaultDataTable and I want to get the index of the selected
> item.  However the index always returns 0.  Is this by design?
>
>                 new AbstractColumn(new Model("Test Label"))
>                {
>                        public void populateItem(Item item, String 
> componentId, IModel model)
>                        {
>                                int selectedIndex = item.getIndex();  //this 
> always returns 0;
>                        }
>                }
>
> However, with a dataView, I do get the item index:
>
>                dataView = new DataView("dataview", dp)
>                {
>                        @Override
>                        protected void populateItem(final Item item)
>                        {
>                                int selectedIndex = item.getIndex();  
> //increments by 1 with each
> iteration.
>                        }
>                }
>
> I considered using a DataView instead of the DefaultDataTable, but the DDT
> has the toolbars and such already nicely built in.  Looking at the code, it
> seems like an Item in a DataView represents the entire row
> whereas in the DataGridView from the DefaultDataTable, it represents a cell.
> Is this why the behavior
> is different?

Yes, inside the column you do not have access to the row index, only
to the column index. apparently this is your first column.

Maurice

>
> Thanks very much.
> --
> View this message in context: 
> http://www.nabble.com/Item.getIndex%28%29-on-DefaultDataTable-tp17676006p17676006.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to