How to clear kendo grid when through combo box value

3 posts, 2 answers
  1. Austin
    Austin avatar
    8 posts
    Member since:
    Sep 2016

    Posted 15 Sep Link to this post

    when the first time generate the grid with data is fine but once i select another type id then it cause the problem happen on the grid. The second image will show the problem.

    Code :http://jsbin.com/wasalutugo/edit?js,output

  2. Answer
    Christian
    Christian avatar
    14 posts
    Member since:
    Nov 2015

    Posted 15 Sep in reply to Austin Link to this post

    Hi,

     

    I think you're problem is because of you don't destroy grid before recreate it. When you do $("#grid").kendoGrid(options), it take the div and add all stuff about Grid.

     

    To solve that, you can destroy the grid before :

    $("#get").click(function() {
        var clientInfo = cType.value();
                           
        var grid = $("#grid").data("kendoGrid");
        if(grid){
            grid.destroy();
            $("#grid").html("");
        }
        /* Do stuff */
    });

     

    Regards

  3. Kendo UI is VS 2017 Ready
  4. Answer
    Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    349 posts

    Posted 17 Sep Link to this post

    Hi,

    As already mentioned, widgets must be either destroyed before other widgets can be initialized from the same element, or you can use the setOptions() method to change the configuration options of a given Grid:

    http://jsbin.com/nerupiloro/edit?js,output

    I hope this helps.

    Regards,
    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top