This is a migrated thread and some comments may be shown as answers.

Organizing Kendo spreadsheet codes

3 Answers 110 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Iffat
Top achievements
Rank 1
Veteran
Iffat asked on 15 Mar 2021, 05:50 AM

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

Sort by
0
Ivan Danchev
Telerik team
answered on 17 Mar 2021, 05:20 PM

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.

0
Iffat
Top achievements
Rank 1
Veteran
answered on 17 Mar 2021, 09:35 PM

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;
    });

0
Stoyan
Telerik team
answered on 22 Mar 2021, 05:18 PM

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/.

Tags
Spreadsheet
Asked by
Iffat
Top achievements
Rank 1
Veteran
Answers by
Ivan Danchev
Telerik team
Iffat
Top achievements
Rank 1
Veteran
Stoyan
Telerik team
Share this question
or