Hi,

>
> 1.       How to highlight/color differently the currently 'selected' row in
> the data table. I have implemented the select functionality by using the
> AjaxEventBehavior as shown the snippet below.
>
>
>
> dataTable = new DataTable( "dataTable", columns, employeeListDataProvider,
> 20) {
>
>                                                 @Override
>
>                                                 protected Item
> newRowItem(String id, int index, final IModel model) {
>
>
> rowItem.add(
> new AjaxEventBehavior( "click") {
>
>
> @Override
>
>
> protected void onEvent(AjaxRequestTarget target) {
>
>
> selectedEmployee = (Employee) model.getObject( );
>
>
> }
>
>                                                                 } );
>
>
>
>                                                                 return
> rowItem;
>
>                                                 }
>
>
>
>                                 };
>

1- Generate an ID for each row of the date
2- Create a JavaScript function toggleSelect(idOfRow): this function checks
if a row has class "selected" (or not) and sets/unsets it
3- on server side target.appendJavaScript("toggleSelect('idOfRow');
4- Use CSS to draw selected rows diffrenetly


>
> The select functionality is working just fine, but now I want to show the
> row corresponding to the selected employee in a different color. The
> selected row should display as 'selected' even when the user navigates to
> another page (page means the datatable page using paging navigator and not
> WebPage) and then navigates back to the original datatable page.
>
> If row is selected add class selected to row wen table is rendered (there
is an overridable method on datatable the generates the RowItem : just do
item.add(AttributeAppender.for("class")

>
>
> 2.       My list of employees is pretty large and I am using a
> BootstrapAjaxPagingNavigator along with the datatable. Now in some cases I
> want to programmatically show a particular employee as selected. So for
> this, I need some means to find the datatable page number which will have
> the desired employee,  I then need to programmatically display that
> particular datatable page and then I need to show the row corresponding to
> the desired employee as highlighted/selected. To complicate matters
> further,
> my datatable is styled to display vertical scroll bars. So if possible,
> after displaying the correct datatable page, the datatable should
> automatically scroll-up or scroll-down to ensure that the row corresponding
> to the desired employee, is always visible to the user.
>

Use plugin ScrollTo?


>
> Any pointers to get the above two use cases working ?
>
>
>
>
>
> Warm regards,
>
>
>
> Anup
>
>
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>



-- 
Regards - Ernesto Reinaldo Barreiro

Reply via email to