PDA

View Full Version : [CLOSED] MVC pass extra parameter to Store AjaxProxy Url.Action



registrator
Feb 20, 2015, 7:49 PM
I am trying to pass in a hidden Id filed value to the Stores AjaxProxy method call.

I have tried:


.Url(Url.Action("GetCompanies", "CompData", new { id = "App.HidId.getValue()" }))

This returns not found route when the extra param is there.

I have tried:


Html.X().AjaxProxy()
.Url(Url.Action("GetCompanies"))
.Reader(Html.X().JsonReader().Root("data"))
.ExtraParams(x => x.Add(new Parameter() { Name = "id", Value = "App.hidid.getValue()", Mode = ParameterMode.Raw }))

This does not even open the window where this is called from when I add the ExtraParams part. No exception, nothing... strange.

My question is, what is the correct way for passing in an extra parameter when calling a method for the AjaxProxy?

Thank you

fabricio.murta
Feb 21, 2015, 1:48 AM
Hello @registrator!

Look at this example: Ajax Linked Combos (http://mvc.ext.net/#/Form_ComboBox/Ajax_Linked_Combos/)

See how they pass the country to retrieve the list of cities for that country. country is a string parameter to the getCities() method.

Hope this helps!

registrator
Feb 21, 2015, 7:52 AM
Thank you @fabricio

It works. So the parameter is added to the Store definition and not the AjaxProxy. This is where I went wrong in the start.

fabricio.murta
Feb 21, 2015, 4:28 PM
Glad it worked! I suppose we may close this thread now, then?

Let us know otherwise.

registrator
Feb 21, 2015, 8:32 PM
Yes, sure. Thank you.