- Home
- Forum
- ASP.NET MVC
- How to print the paging bar above the grid.
How to print the paging bar above the grid.
Thanks for contacting Syncfusion support.
We have created a sample to display the grid pager both at bottom and top of the Grid, which can be downloaded from the below location.
Sample Link: http://www.syncfusion.com/downloads/support/forum/121799/ze/Sample-1148870421
In the above sample, we have cloned the pager bar element and have inserted the cloned element before the grid header in the DataBound event of the grid. Please refer to the below code example.
|
@(Html.EJ().Grid<object>("Grid") . . . . . .ClientSideEvents(eve=>eve.DataBound("dataBound")) )
<script type="text/javascript"> function dataBound(args) { var pager = $("#"+this._id+" .e-pager").clone();//get the clone element of grid pager pager.insertBefore("#"+this._id+" .e-gridheader");//insert the cloned element before the grid header } <script type="text/javascript"> function dataBound(args) { $("#"+this._id+" .e-pager").insertBefore("#" + this._id + " .e-gridheader");//insert the pager element before the grid header } |
Please try the above solution. If we have misunderstood your requirement, please get back with more and clear information on your requirement.
Regards,
Ragavee U S.
While appending the pager to both top and bottom of the grid, we have to perform custom paging operation on the cloned pager to reflect the changes in the Grid. Please refer to the code example.
|
<script type="text/javascript">
//actionComplete event of the Grid function onComplete(args) { processTopPager(this); // Perform clone pager functionalities }
function processTopPager(gridObj) { // Create a clone pager var pagerClone = gridObj.getPager().clone(true); // Replace the id to numeric container element in the clone pager pagerClone.find("#NumericContainer").prop("id", "NumericContainer1");
// Prepend the clone element in the Grid control if (gridObj.element.find("#clonePager").length) gridObj.element.find("#clonePager").html(pagerClone.html()); else gridObj.element.prepend(pagerClone.prop("id", "clonePager"));
// Perform Paging operation while clicking clone pager gridObj.element.find("#NumericContainer1 a").click(function (e) { $("#Grid").ejGrid("gotoPage", $(this).html()); }); } |
We have modified the previously provided sample with the above provided solution.
Sample Link: http://www.syncfusion.com/downloads/support/forum/121799/ze/Sample_modified-234639042
Regards,
Ragavee U S.
- 3 Replies
- 2 Participants
-
AY Ayane
- Jan 26, 2016 07:57 PM UTC
- Feb 2, 2016 06:15 AM UTC