This is a migrated thread and some comments may be shown as answers.

set current page index and row focus in javascript

1 Answer 255 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shannnon
Top achievements
Rank 1
Shannnon asked on 07 Apr 2011, 10:24 PM
var grid = $find(gridID);          
 var masterTable = grid.get_masterTableView();
            var dataItems = masterTable.get_dataItems();
            var row = dataItems[itemIndex].get_element();
            masterTable.set_currentPageIndex(page);
            row.focus();
What I am trying to do is: i have a textbox with a number and when I mouse over on it, I pass the number to the parameters of "page" and "itemIndex", I want the grid show on that page and also focus on the row of that number. I can see the grid is refreshed on mouseover but the current page stay unchanged and the row focus doesn't work, if I change to masterTable.selectItem(row), it works ONLY when the current page is set to the one contains that row. Did I miss anything?

Thank you!

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 12 Apr 2011, 03:49 PM
Hello Shannnon,

You can change the page of the grid if needed. In this help topic it is shown how to trigger the page command.
http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-page.html.
Notice that pageCommand could be a number.

Keep in mind that if you use server binding the grid will make postback (or ajax reuqest) to populate the data for the new page. So you will need to handle OnGridCreated client event to focus the row after the grid is paged and recreated.

Best wishes,
Vasil
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Shannnon
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or