Click here to Skip to main content
15,916,318 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This code gives me the columns names:
JavaScript
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 21:41pm
v2

1 solution

Here is the correct code:
JavaScript
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);
            }
        }
    }
}
 
Share this answer
 

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