Click here to Skip to main content
14,735,933 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This code gives me the columns names:
var columnsNames = new Array();
var columns = $("#grid1").data("kendoGrid").columns;
if (columns.length > 0) {
    for (var i = 0; i < columns.length; i++) {
        var col = columns[i];
        if (col.field != undefined) {
            columnsNames.push(col.field);
        }
    }
}

But after I click on ColumnMenu and remove some columns from the grid I want to use this code while the grid shows new count of columns.

Thanks for response!

What I have tried:

I tried to find new schema of the grid after changing the columns but I even couldn't find the new schema.
Posted
Updated 9-Jul-16 22:41pm
v2

1 solution

Here is the correct code:
var columnsNotHidden = new Array();
var columns = $("#grid1").data("kendoGrid").columns;
if (columns.length > 0) {
    for (var i = 0; i < columns.length; i++) {
        var col = columns[i];
        if (col.field != undefined) {
            if (col.hidden != true) {
                columnsNotHidden.push(col.field);
            }
        }
    }
}
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900