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

client side force rebind to page 1 - page number in pager not correct

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 21 Mar 2011, 08:03 PM
Hello,

I am using the client object model. I want to force a rebind of the grid back to page 1. I am having trouble setting the page number in the pager back to 1 (if I am on page 2 before the rebind).

This code does not always rebind - typically when already on the first page, but also under other conditions.
tableView.set_currentPageIndex(0, true);

This code rebinds, but does not reset the page number in the pager to page 1 if I was on page 2.
var tableView = $find(radGridPracticesClientID).get_masterTableView();
tableView.rebind();

So I cannot use this:
if (currentPageIndex == 0) { 
    tableView.rebind(); 
else
    // buggy - does not always rebind - e.g. when new results are less than 1 page 
    tableView.set_currentPageIndex(0, true); 
}

Finally, this code is equivalent to tableView.rebind() it always rebinds and gets the results for page 1 but does not set the page number in the pager to 1. The page count IS correct.
            var currentPageIndex = 0;   
            PageMethods.GetPracticesAndCount(currentPageIndex, pageSize, 
              sortExpressions, filterExpressions, installationID, 
              environmentalWeight, regulatoryWeight, 
              publicPerceptionWeight, healthAndSafetyWeight, 
              includeAspects, includeImpacts, checkedCommandIDs, selectedLocationIDs, 
              rebindPracticeGridResult);
        }
  
function rebindPracticeGridResult(result) { 
     var tableView = $find("ctl00_PlaceHolderMain_Practice1_RadGridPractices").get_masterTableView(); 
     tableView.set_dataSource(result.Practices);
     tableView.dataBind();
     tableView.set_virtualItemCount(result.PracticeCount);
}

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 24 Mar 2011, 02:58 PM
Hi Macrel,

I would suggest you to invoke trigger page command for the grid using fireCommand from client side. The method is called for the GridTableView client instance.

Refer the following documentation for more information about using fireCommand from client side.
fireCommand



All the best,
Maria Ilieva
the Telerik team
Tags
Grid
Asked by
Marcel
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or