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

[Solved] Is there any client side function available to trigger grid's pager number's click event using javascript ?

3 Answers 539 Views
Grid
This is a migrated thread and some comments may be shown as answers.
gafoor
Top achievements
Rank 1
gafoor asked on 07 Jul 2014, 06:36 AM
Hello,

My requirement is to refresh ajaxified grid's data based on some conditions from client side using jquery.
As a temporary solution, I have written following jquery code:

$("a.rgCurrentPage").each(function () {
                    $(this).removeAttr("onclick");
                    $(this)[0].click();
                });

Is telerik provided any client side function to trigger radgrid's pager number's click event using javascript ?

thank you in advance
Gafoor.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Jul 2014, 06:56 AM
Hi Gafoor,

You can use the OnCommand client event of the Grid, which fires during paging.

ASPX:
<ClientSettings>
 <ClientEvents OnCommand="OnGridCommand" />
</ClientSettings>

JS:
<script type="text/javascript">
 function OnGridCommand(sender, args) {
     if (args.get_commandName() == "Page") {
         alert("Page Index Changed");       
      }
     else if (args.get_commandName() == "PageSize") {
         alert("Page Size Changed");        
      }
   }
</script>

Thanks,
Princy
0
gafoor
Top achievements
Rank 1
answered on 07 Jul 2014, 07:09 AM
Hi Princy,

Thank you for your quick response.

I think OnCommand event will be fired when the user manually clicks on radgrid's page number.    But what i want is to fire radgrid's page number's click event using jquery/javascript automatically based on some condition.  Its better to use any predefined function from telerik  instead of writing my own code to trigger radgrid's page number's (anchor tag) click event.  

Thank you,
Gafoor.
0
Princy
Top achievements
Rank 2
answered on 08 Jul 2014, 03:40 AM
Hi Gafoor,

I guess you want to triggers specific command for the grid. You can use the fireCommand method. Please check the article and let me know if any concern.

Thanks,
Princy
Tags
Grid
Asked by
gafoor
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
gafoor
Top achievements
Rank 1
Share this question
or