Update datasource using Controllers(MVC) and RoutedValues

2 posts, 0 answers
  1. Erick
    Erick avatar
    4 posts
    Member since:
    Sep 2012

    Posted 28 Jan 2013 Link to this post

    When I define a Chart for the first time, I put the Action Name, Controller Name and Route Values:
    .DataSource(datasource => datasource
    .Read(read => read.Action("DataForEvo", "Home", new { seriename = "Default", category = "Default" }))
    But later, I need to reload the chart with new 'route values':
    I have 2 charts in the same page, at the bottom a "Bar Chart", and at the top a "Line Chart", when the user click any serie of the Bar Chart, the Line Chart should be updated with relative data.

    In the "Bar Chart" I have the Series Click event:
    .Events(ev => ev.SeriesClick("onSeriesClick")))

    where I can capture the serie name, category and value. From here using jquery I can capture the chart
    var Chart = $("#chart").data("kendoChart");

    maybe exist a method or way to call again the action with new 'route values'.

    Many Thanks.
  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 30 Jan 2013 Link to this post

    Hello Erick,

    Basically in such case you should use the dataSource.read() method to perform new Ajax request. You can send additional parameters to the server either with the help of the data function or you can pass them directly to the method like this:

    $('#theOtherChart').data().kendoChart.dataSource.read({ seriename : "someNewValue", category : "someOther" })

    Kind Regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top