We recommend reviewing what is submitted before posting, in case your idea has already been submitted by another community member. If it has been submitted, vote for that existing feature request (by clicking the up arrow) to increase its opportunity of being added to Cireson solutions.
For more information around feature requests in the Cireson Community click here.
Create An Export to CSV/Excel Tool for Grid Views
We have this request several times a week from analysts and especially IT management who would like to be able to easy pull the results they get from their custom searches into Excel to create graphs and work with the data for further analysis.
If anyone has anything that they currently use, please (I beg) feel free to share. Ultimately, though, I'd love to see something directly within the portal itself.
Comments
I would to have this enabled for Knowledge Articles. would make management a lot easier.
thanks,
Hi,
as a quick workaround, you can use the standard Excel / PDF grid functionality from Kendo UI. I’ve made a quick check and it seems to work (at least in my development environment / 6.0.2).
custom.js
// the jszip is necessary for the Excel export – this file is already in the Kendo distribution
// there is maybe a better way to load this ….
//
var add_jszip = document.createElement('script');
add_jszip.setAttribute('src','/Scripts/kendo/2016.1.226/jszip.min.js');
document.head.appendChild(add_jszip);
// based on the idea of custom grid view filter from joivan_hedrick ….
// this will place the excel and pdf button on top the of grid views …
//
$(document).ready(function ()
{setTimeout(function() {
$('[data-role=grid]').each(function (index)
{ $(this).data('kendoGrid').options.excel={fileName:"CiresonPortal.xlsx", allPages:true, proxyURL: ""};
$(this).data('kendoGrid').options.pdf={allPages:true, proxyURL: ""};
var resetViewButtonParentDiv = $(".btn-clear-grid-filters").first().parent();
$(resetViewButtonParentDiv).append("<a class='k-button k-button-icontext k-grid-excel' href='#'><span class='k-icon k-i-excel'></span>Export to Excel</a>");
$(resetViewButtonParentDiv).append("<a class='k-button k-button-icontext k-grid-pdf' href='#'><span class='k-icon k-i-pdf'></span>Export to PDF</a>");
});
},1000);
});
the only thing you need to do, is just using the custom.js which i have provided above
I am not a JavaScript expert - but only those few lines will do it.
Hope this helps
--> http://docs.telerik.com/kendo-ui/controls/data-management/grid/excel-export
Ridiculousness! Had to try this out, and love the result.
It takes the current grid view (all pages), retains grouping structure and exports to excel in proper layout with no need to manipulate the output.
Great eye and help @Roland_kind!
yes, you can create your own gridviews (at the moment I create them using the SCSM Console (or VS) and publish them to the Portal ...) - the Excel Export will also work on those views (I assume it will work on every grid view - but I have not tested this so far ...). For more Excel customization maybe the following link will help
--> http://docs.telerik.com/kendo-ui/controls/data-management/grid/excel-export#customize-the-excel-document
Only problem is my theory falls apart here, because I just tried dropping only this customization into custom.js with everything else gone and pages still don't load. Hrmmm....
btw: did you check that the file '/Scripts/kendo/2016.1.226/jszip.min.js' exists ?
and it is important, that the loading of this file is done, on the top of the custom.js file (frist three lines - it cannot be done inside a function)
The issue here seems to be that jszip is supposed to load before kendo. Since the portal uses RequireJS, there are special considerations there, as well. I have not found the solution yet, but hopefully this leads someone in the right direction.
I am also getting errors about certain fonts not being present, etc., but for now I assume that they are other symptoms of jszip not loading in time.
the enclosed zip file contains the modified version (alternate loader to check if grid is valid...). in addition to that it might be necessary to "reset your view" to default - with the "reset view" button first.
I have done large exports (> 12.000 rows) without any problems.
Please note the file is named custom_.js
The kendo docs clearly point to the fact that you need to be able to load JSZip before kendo, and also need to be able to establish the relationship between JQuery, Kendo, and JSZip (in that order) using RequireJS. The problem is that all this happens in the Cireson code before custom.js is run.
So I am really curious how it is working for you @Roland_Kind. I can see why it isn't for me, but why would it load in a different order for you? Answering that question may be the key to getting this to work for everyone.
thanks for the info - I have changed the loader to use require.js for loading the jszip file. I have enclosed a new version of the custom.js file. In my test environment it works without any issue - do you have the possibility to test it in your test environment ?
As for the results....significant progress!
- Export to Excel now works flawlessly with no errors!
- Export to PDF generates 3 errors in the console about not being able to find /Content/Kendo/2016.1.226/web/fonts/DejaVu/DejaVuSans.ttf.
#2 seems like something we ought to be able to solve. I do not have much time to spend today, but I can look at it next week. Perhaps other experts here will have it solved by then!Thanks for working on a fix. This is an excellent feature you are helping us all enable!
thanks a lot for the testing and the great news :-) and I am happy to see it works now (at least for the Excel Export)
The folder exists and the license txt file for the font is present, but the TTF itself is not there, in my install. Can anyone else confirm whether this file is present or missing for them?
unfortunately my previous answer was incorrect - I messed up the folders
a) \Content\Kendo\2016.1.226 (for the Fonts etc. - but only the license.txt file is available - the same as you described for 7.x)
b) \Scripts\kendo\2016.1.226 (with jszip.js etc.)
both folders are present in 6.0.x - but as I have mentioned before - I do not receive errors when creating a PDF in 6.0.x
As far as I know the dejavu fonts can be obtained from sourcefrog (MIT License) - therefore I think it is no problem applying the workaround you have mentioned (just copying the dejavusans.ttf to the appropriate directory)
For the Excel/PDF Export I have not added any files to the original Cireson/Kendo Distribution - except the custom.js file
I have tried this but when I check my folder structure under scripts\Kendo I have a folder 2013.3.1119 and only have jquery.min.js but no jszip.js
as far as I know you need a Portal Version 6.x or higher to use the Excel Export. It depends on a newer Kendo UI Version (>= 2014.3.1119)