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

[Solved] Force ajax load with additional parameters

4 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Piero Casiraghi
Top achievements
Rank 1
Piero Casiraghi asked on 25 Feb 2010, 12:32 AM
I have a form that contains optional fields of research.
When a user fills out these fields and press the submit button, I need the grid to run the ajax call passing these optional parameters.

I do not know before the values that the user could enter, so I can not write something like this:

. Ajax (ajax => ajax.Action (ActionName? Opt1 = 'abcde', " ControllerName"))

With JQuery can i write something like this?
. Ajax (ajax => ajax.Action (ActionName? Opt1 = "+ $ ( '# Opt1').Val()," ControllerName "))

The second question is: how can I make the AJAX call of the grid?

$('#myButton').submit(function() {
     //TODO force reload of the grid
return false; });

Thank you

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 Feb 2010, 07:19 AM
Hi Piero Casiraghi,

You can use the rebind client-side method to achieve both. Take a look a this example

All the best,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Piero Casiraghi
Top achievements
Rank 1
answered on 25 Feb 2010, 09:17 AM
So i've  to write something like this:
$('#myButton').submit(function() { 
      
   var ordersGrid = $('#Orders').data('tGrid'); 
   
 
    ordersGrid  
 
      .rebind({ 
                        opt1: $('#opt1').val(), 
                        opt2: $('#opt2').val(), 
                    }); 
 
    return false; 
}); 
 
 

and then change the ajaxCall
 .Ajax(ajax => ajax.Action("_RelatedGrids_Orders", "Grid", new { opt1 = "",opt2="" }))

Is it correct?

Thank you


                 

0
Atanas Korchev
Telerik team
answered on 25 Feb 2010, 09:20 AM
Hello Piero Casiraghi,

Should be. I am not fully aware of your scenario. Give it a try and let us know if you've hit some obstacles.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Piero Casiraghi
Top achievements
Rank 1
answered on 26 Feb 2010, 12:27 AM
It works!
Thanks for your help.
You are much faster in responding to problems than another one of your famous competitor.
A point in your favor. :-)
Tags
Grid
Asked by
Piero Casiraghi
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Piero Casiraghi
Top achievements
Rank 1
Share this question
or