This question is locked. New answers and comments are not allowed.
Daniel Blendea
Top achievements
Rank 1
Daniel Blendea
asked on 11 Nov 2011, 03:42 PM
Hello,
I'm using the chart with ajax binding.
The user must change some parameters (through combo-boxes), then send those parameters to server to generate the chart.
I've seen the sample
Is there an API to set the values client-side?
I'm using the chart with ajax binding.
The user must change some parameters (through combo-boxes), then send those parameters to server to generate the chart.
I've seen the sample
but ViewData is set on server-side and not on client-side..Select("_AjaxBinding","Home",new{ year = ViewData["year"] })
Is there an API to set the values client-side?
5 Answers, 1 is accepted
0
mo2011ti
Top achievements
Rank 1
answered on 14 Nov 2011, 07:35 AM
Hi,
i have the sa,e problem.
Telerik - please reply asap.
Thanks,
Moti
i have the sa,e problem.
Telerik - please reply asap.
Thanks,
Moti
0
Daniel Blendea
Top achievements
Rank 1
answered on 14 Nov 2011, 08:39 AM
I ended up with something like this:
and the viewModel.postUrl is:
Maybe not the most elegant way, but it works.
function Refresh()
{ var chart = $("#chart").data("tChart"); chart.options.dataSource.transport.read.url = viewModel.postUrl(); chart.refresh();} and the viewModel.postUrl is:
viewModel.postUrl = function(){ return "@Url.Action( "<action>", "<controller>" )" + "?Step=" + viewModel.selectedStep() + "&Cat=" + viewModel.selectedCategory();}Maybe not the most elegant way, but it works.
0
Daniel Blendea
Top achievements
Rank 1
answered on 25 Nov 2011, 04:22 PM
According to this http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-chart-client-api-and-events.html,
there is another way of changing the parameters with javascript:
there is another way of changing the parameters with javascript:
rebind
The rebind method rebinds a client-side bound chart. You can pass additional arguments to the action method method using rebind.<script type="text/javascript"> var chart = $('#chart').data('tChart'); chart.rebind({ userId: 42 }});</script>0
Daniel Blendea
Top achievements
Rank 1
answered on 16 Dec 2011, 02:55 PM
But apparently there is no rebind function for the Chart object, even though the documentation clearly states:
rebind
The rebind method rebinds a client-side bound chart.
You can pass additional arguments to the action method method using rebind.
<script type="text/javascript"> var chart = $('#chart').data('tChart'); chart.rebind({ userId: 42 }}); </script>
0
Hi Daniel,
You should update update the version of the Telerik MVC Controls to 2011.3.1115 in order to use the rebind method. There is a Client-Side API demo available which shows how to use it.
Best wishes,
Daniel
the Telerik team
You should update update the version of the Telerik MVC Controls to 2011.3.1115 in order to use the rebind method. There is a Client-Side API demo available which shows how to use it.
Best wishes,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now