Guys I have been trying to find a clean way to organize Kendo spreadsheet codes. I want to add separate file for all the settings (all configuration of the sheet) and separate JS file for all the methods. I was wondering if you guys have a working example for that?
Thanks & Regards
Iffat
3 Answers, 1 is accepted
Hello Iffat,
Using a separate js file for the methods is straightforward: the file must be loaded on the page where the component is initialized. Attached you can find a sample web site that demonstrates this.
The external js file called myMethods.js is loaded on the sample page:
<script src="scripts/myMethods.js"></script>
It contains two event handlers: a click event handler for the button above the Spreadsheet and an event handler of the Spreadsheet itself. On clicking the button, the Spreadsheet's API is used to export its content to pdf.
Regards,
Ivan Danchev
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Thanks a lot.
The settings section going to be very long in my project, will have 14 columns, and different formulas, different headers and summary rows. That is why the setup looks a bit messy in my project.
So was thinking can I achieve something like following
$("#spreadsheet").kendoSpreadsheet({
settings: myJsFileName.configuration;
});
Hi Iffat,
Ivan is currently out of office. I am temporarily taking over so there is no delay in getting you an answer.
Set up the configuration of the Spreadsheet in а variable. If the variable is in another .js file, include the file in the View and then pass it to the Spreadsheet on initialization.
var configuration = { /*Spreadsheet configuration here*/ };
$("#spreadsheet").kendoSpreadsheet(configuration);
I have applied the above in this Dojo.
Alternatively, you could utilize the remote binding of the Spreadsheet's dataSource.
I hope the above helps. Please let me know, if you have further questions.
Regards,
Stoyan
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.