You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Swanthe Lindgren <sw...@megasol.se> on 2009/10/02 11:25:24 UTC

inMethod DataGrid initial selection

Does anybody know how to get a row initially selected when the grid is 
first drawn?

//Swanthe


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


Re: inMethod DataGrid initial selection

Posted by Swanthe Lindgren <sw...@megasol.se>.
Thank you Matej, I was just about to write a "solved" to the list. As I 
used different model implementations for the pre-selected row and the 
other rows, the equals and hashCode methods didn't match up.

BTW, thanx for an excellent  data grid!

//Swanthe

Matej Knopp wrote:
> Make sure that the equals method on your model(s) is properly
> implemented. Also check equals on your entities.
>
> -Matej
>
> On Fri, Oct 2, 2009 at 1:37 PM, Swanthe Lindgren
> <sw...@megasol.se> wrote:
>   
>> Yes, I got that part right, thank you. But somehow the item is not
>> hi-lighted in my grid.
>> When the grid instance is constructed and added to the page, the data to be
>> shown in the grid has not yet been loaded. I know that the row i want
>> selected is going to be there once the data is loaded and the grid is
>> displayed, so I tried to create a Model containing the selected object and
>> setting it on the grid with DataGrid.selectItem(), and obviously it
>> partially works since other components that are depending on the grid for
>> model data is displaying the item correct information from the preselected
>> item.
>> But still, the row in the displayed grid remains unselected.
>>
>> So far I have configured my grid with
>> datagrid.setRowsPerPage(10);
>> datagrid.setClickRowToSelect(true);
>> datagrid.setClickRowToDeselect(false);
>> datagrid.setAllowSelectMultiple(false);
>> datagrid.selectItem(preselectedModel, true);
>>
>>
>> Any other suggestions?
>>
>> Martin Grigorov wrote:
>>     
>>> grid.selectItem(rowModel);
>>>
>>> El vie, 02-10-2009 a las 11:25 +0200, Swanthe Lindgren escribió:
>>>
>>>       
>>>> Does anybody know how to get a row initially selected when the grid is
>>>> first drawn?
>>>>
>>>> //Swanthe
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>>
>>>       
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>   



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


Re: inMethod DataGrid initial selection

Posted by Matej Knopp <ma...@gmail.com>.
Make sure that the equals method on your model(s) is properly
implemented. Also check equals on your entities.

-Matej

On Fri, Oct 2, 2009 at 1:37 PM, Swanthe Lindgren
<sw...@megasol.se> wrote:
> Yes, I got that part right, thank you. But somehow the item is not
> hi-lighted in my grid.
> When the grid instance is constructed and added to the page, the data to be
> shown in the grid has not yet been loaded. I know that the row i want
> selected is going to be there once the data is loaded and the grid is
> displayed, so I tried to create a Model containing the selected object and
> setting it on the grid with DataGrid.selectItem(), and obviously it
> partially works since other components that are depending on the grid for
> model data is displaying the item correct information from the preselected
> item.
> But still, the row in the displayed grid remains unselected.
>
> So far I have configured my grid with
> datagrid.setRowsPerPage(10);
> datagrid.setClickRowToSelect(true);
> datagrid.setClickRowToDeselect(false);
> datagrid.setAllowSelectMultiple(false);
> datagrid.selectItem(preselectedModel, true);
>
>
> Any other suggestions?
>
> Martin Grigorov wrote:
>>
>> grid.selectItem(rowModel);
>>
>> El vie, 02-10-2009 a las 11:25 +0200, Swanthe Lindgren escribió:
>>
>>>
>>> Does anybody know how to get a row initially selected when the grid is
>>> first drawn?
>>>
>>> //Swanthe
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: inMethod DataGrid initial selection

Posted by Swanthe Lindgren <sw...@megasol.se>.
Yes, I got that part right, thank you. But somehow the item is not 
hi-lighted in my grid.
When the grid instance is constructed and added to the page, the data to 
be shown in the grid has not yet been loaded. I know that the row i want 
selected is going to be there once the data is loaded and the grid is 
displayed, so I tried to create a Model containing the selected object 
and setting it on the grid with DataGrid.selectItem(), and obviously it 
partially works since other components that are depending on the grid 
for model data is displaying the item correct information from the 
preselected item.
But still, the row in the displayed grid remains unselected.

So far I have configured my grid with
datagrid.setRowsPerPage(10);
datagrid.setClickRowToSelect(true);
datagrid.setClickRowToDeselect(false);
datagrid.setAllowSelectMultiple(false);
datagrid.selectItem(preselectedModel, true);


Any other suggestions?

Martin Grigorov wrote:
> grid.selectItem(rowModel);
>
> El vie, 02-10-2009 a las 11:25 +0200, Swanthe Lindgren escribió:
>   
>> Does anybody know how to get a row initially selected when the grid is 
>> first drawn?
>>
>> //Swanthe
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>   



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


Re: inMethod DataGrid initial selection

Posted by Martin Grigorov <mc...@e-card.bg>.
grid.selectItem(rowModel);

El vie, 02-10-2009 a las 11:25 +0200, Swanthe Lindgren escribió:
> Does anybody know how to get a row initially selected when the grid is 
> first drawn?
> 
> //Swanthe
> 
> 
> ---------------------------------------------------------------------
> 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