Update datasource?

4 posts, 0 answers
  1. Kyle
    Kyle avatar
    45 posts
    Member since:
    Mar 2012

    Posted 02 Apr 2012 Link to this post

    I have a datasource/grid that I would like to update depending on selected in a TreeView.

    I have my datasource created like so:

            dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "/api/items",
                        dataType: "json",
                        data: { id: "1" }

    When a user selected an item on the TreeView I want to update the datasource to change the id that defines its results. Can I just create a new dataSource with the new {data: {id: "newid"}}?

    How would I then apply this to the grid that already exists?
  2. Rosen
    Rosen avatar
    3253 posts

    Posted 04 Apr 2012 Link to this post

    Hi Kyle,

    You may change a parameters defined through the transport's operation data by assigning a function which to return the updated value. Please refer to this online demo for more details. Note the q parameter's definition.

    All the best,
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Juan
    Juan avatar
    18 posts
    Member since:
    Mar 2012

    Posted 10 Apr 2012 Link to this post

    Thanks you, is work fine in my code.
  4. Muhammad
    Muhammad avatar
    4 posts
    Member since:
    Nov 2010

    Posted 08 Nov 2012 Link to this post

    is working in the "update" add this code in the transport:
                   complete: function(e) {

    thanks a lot
Back to Top