[PITA] Excel Export (still)

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

[PITA] Excel Export (still)

Post by Jaymer »

Jump to Solution


Per the recent thread, Excel export is still not working correctly.

I added
config.toolbar = ["excel"]

to Init Script, and it immediately showed a new non-aware export Button.
But at runtime, clicking that button does nothing.

And since I was using a custom header on my grid, I found a post to add this:

Code: Select all

<a class="k-button k-button-icontext k-grid-excel" href="#"><span class="k-icon k-i-excel"></span>Export to Excel</a>
<a class="k-button k-button-icontext k-grid-pdf" href="#"><span class="k-icon k-i-pdf"></span>Export to PDF</a>
This gave me nice buttons, but still nothing happens when clicked.

Then, a post that talked about this:
Yes, the Excel configuration of the grid does not depend on the toolbar command. The only requirement is to add the k-grid-excel class to the excel export command as the click event is attached as follows:

container.on(CLICK + NS, ".k-grid-excel", function(e) {
e.preventDefault();

that.saveAsExcel();
});
But that syntax, using "container" doesn't work in Aware... there is no "container", so thats got to be "this" or "widget" or something... working on it.

Exporting to Excel is such a basic function in software today, its surprising that its so difficult to get this working from a grid to allow the user to get his data out of the db.
Last edited by Jaymer on Mon Apr 13, 2020 8:00 pm, edited 4 times in total.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Excel Export (still)

Post by johntalbott »

config.toolbar = ["excel"] is working consistently for me.

Have you tried this in a simple grid .. maybe CRM sample?
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Excel Export (still)

Post by Jaymer »

Found this in my console:

kendo.all.js:11436 Uncaught Error: JSZip not found. Check http://docs.telerik.com/kendo-ui/framew ... quirements for more details.
at kendo.ooxml.createZip (kendo.all.js:11436)

currently, I'm getting this in my app.
But I saw this work in the CRM sample, then I monkeyed around and tried lots of variations in my app - pretty sure it worked a few times. Now, back to no action when clicking the button.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Excel Export (still)

Post by johntalbott »

Do you try the fix described in the Kendo article?
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Excel Export (still)

Post by Jaymer »

I don't see why the fix would be BSV-specific.

It works on CRM sample, but not on my app.
hmm, maybe there's an internal threshhold for kicking in the Zip... if its a small export already (like Customers from CRM) then maybe no Zip is attempted.

k, will try that extra code.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
johntalbott
Posts: 619
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, Nebraska
Contact:

Re: Excel Export (still)

Post by johntalbott »

You're right .. it shouldn't be BSV specific. I missed that it is working for you in CRM app.
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Excel Export (still)

Post by Jaymer »

I think it worked in sample CRM on Customers because it was a tiny amount of data.

Trying it in my main app now works after adding the JSZIP class specified in the Kendo error message above.

So, I get an Excel export now, but its only the 1st page - 20 records out of many.

I cannot get any combination of Init script lines to output all records:

config.toolbar = ["excel","pdf"];
config.excel.allPages = true;
--> Exception running initial script for query RO TypeError: Cannot set property 'allPages' of undefined

config.excel.AllPages = true;
--> Exception running initial script for query RO TypeError: Cannot set property 'AllPages' of undefined

config.Excel.AllPages = true;
--> Exception running initial script for query RO TypeError: Cannot set property 'AllPages' of undefined

config.Excel.allPages = true;
--> Exception running initial script for query RO TypeError: Cannot set property 'allPages' of undefined
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

SOLUTION

Post by Jaymer »

This works for me, but as I said in the other thread, I get an error using the other syntax:
Screen Shot 2020-04-04 at 8.45.27 PM.png
Screen Shot 2020-04-04 at 8.45.27 PM.png (20.71 KiB) Viewed 10965 times
recap:
Aware Export button on grid only exports first page. Will not export all records in grid.
Even if you make Aware show more records per page, only the first 100 grid rows get exported to the file.

1) Added Kendo Excel Export Button for Excel & PDF (the toolbar line)
2) config.excel to export more than just the 1st page
3) added this to startup.html to include class to zip the excel file (not having this made the click on the button appear to do nothing - but a JS error was on the Console)

Code: Select all

<script src="https://kendo.cdn.telerik.com/2020.1.219/js/jszip.min.js"></script>
ISSUE
1) Aware should fix this to work better. We should be able to access other Kendo export properties (filename, pagination/header/footer (PDFs), ExportAll)
2) Adding their excel/pdf toolbar makes a 2nd toolbar - which is not acceptable. If you MUST have HTML/CSV export, to my knowledge, those are only accessible using Aware, so you'll have those on 1 toolbar, and Excel/PDF on another toolbar.
Screen Shot 2020-04-04 at 9.00.43 PM.png
Screen Shot 2020-04-04 at 9.00.43 PM.png (21.74 KiB) Viewed 10965 times
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

NOTE

Post by Jaymer »

NOTE

Remember that Aware supports "Export to CSV" as a Panel Operation.
This works "correctly" and exports all rows in the Grid.
And Excel is going to import a CSV "perfectly" - so, if you must have Excel data now, just do it via CSV.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: [SOLVED] Excel Export (still)

Post by Jaymer »

Aaarrrggghhh

Customer says clicking Excel Export button does nothing.
Checked it and sure enough... just dead.
This was using the Kendo toolbar method. (Hadn't changed to CSV yet in all places)

The JSZIP stuff is loading.
No Console error msgs.
Just a button that seems to do nothing.

Export to Excel just shouldn't be this tough.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Post Reply