This is a migrated thread and some comments may be shown as answers.

How to clear kendo grid when through combo box value

2 Answers 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Austin
Top achievements
Rank 1
Austin asked on 15 Sep 2016, 08:47 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Licenses
Top achievements
Rank 1
answered on 15 Sep 2016, 09:52 AM

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

0
Accepted
Dimiter Topalov
Telerik team
answered on 17 Sep 2016, 07:25 AM
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.
Tags
Grid
Asked by
Austin
Top achievements
Rank 1
Answers by
Licenses
Top achievements
Rank 1
Dimiter Topalov
Telerik team
Share this question
or