telerik - Export multiple hidden columns for Kendo grid -


here code exporting multiple hidden columns kendo grid,

var exportflag = false; $("#grid").data("kendogrid").bind("excelexport", function (e) { if (!exportflag) {         e.sender.showcolumn(0);         e.preventdefault();         exportflag = true;         settimeout(function () {             e.sender.saveasexcel();        });     } else {         e.sender.hidecolumn(0);        exportflag = false;     } }); 

in above code there given e.sender.showcolumn(0); , need export nth number of columns (export multiple hidden columns) this: e.sender.showcolumn(n);.

how possible?

you can have array of hidden columns. iterate columns , if index in array show it.

function isinarray(value, array) {                 return array.indexof(value) > -1;             }  var hidencoll = [1, 2, 3, 4]; // hidden cols indexes  for(i=0; i< grid.columns.length; i++)             {                 if (isinarray(i,hidencoll))                     grid.showcolumn(i); // grid.hidecolumn(i);                            } 

or if want first n columns:

  for(i=0; i< grid.columns.length; i++)         {            if (i <= n)                  grid.showcolumn(i); // grid.hidecolumn(i);                        } 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -