mercredi 5 juillet 2017

how to hide the first and last object from the array in export excel in kendo.

i am using kendo grid in my ember app. i have to hide the first and last coloumn in export of excel and i have to modify the column width in the excel sheet.

how to hide the object from the array . here is my code ---

     excelExport:function(e) {
                                    e.preventDefault();
                                    var str = e.sender.columns;
                                    var sheet = e.workbook.sheets[0];
                                    var tindex = str.map(function(d) { return d['title']; }).indexOf('Action');
                                    var dindex = str.map(function(d) { return d['field']; }).indexOf('documentKey');

                                    sheet.columns.removeObject(dindex);sheet.columns.removeObject(tindex);

                                  var excelSheetColumns=sheet.columns.filter(function(d){
                                        console.log(">>>>>>"+d);    
                                         //d.removeObject(tindex);
                                         //d.removeObject(dindex);            
                                        d.width=50;
                                        return d;
                                    });
                                    var workbook = new kendo.ooxml.Workbook({
                                        sheets:e.workbook.sheets
                                    });
                                     kendo.saveAs({
                                           dataURI: workbook.toDataURL(),
                                           fileName:"export.xlsx"
                                        });
                               },




Aucun commentaire:

Enregistrer un commentaire