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

Batch Highlighting Cells

5 Answers 86 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 30 Jan 2017, 11:25 AM

I'd like to highlight cells, in a range.forEachCell method, but each cell has to have a different highlight (background colour) based on some rules. It's quite slow. Is there a way to do this quicker?

Thanks,

Marc

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 01 Feb 2017, 09:34 AM
Hello Marc,

I can suggest checking the background method of the Spreadsheet range. This is a faster option to set the background:

http://docs.telerik.com/kendo-ui/api/javascript/spreadsheet/range#methods-background

I made an example to demonstrate this with a bigger range:

http://dojo.telerik.com/iQAYA

If this is not an option, please send a runnable example demonstrating the current implementation, I and will investigate if it can be optimised. 

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 01 Feb 2017, 09:38 AM

Hi Stefan,

To highlight the cell, I am using the .background method. However, my problem is that I am selecting a massive range (5000 cells for instance), and each cell has to have a check to determine which background colour is applied. Is there any other way around this?

Marc

0
Marc
Top achievements
Rank 1
answered on 02 Feb 2017, 01:07 PM

Hi, 

Sorry I did not read your request for an example. I have provided one below, I believe you should be able to access it, although it's the first time I've used the Dojo site so hopefully you can see it.

http://dojo.telerik.com/@marclazell/AkOwi

Thanks

Marc

0
Accepted
Stefan
Telerik team
answered on 03 Feb 2017, 07:32 AM
Hello Marc,

Thank you for the provided example.

I observed the same behaviour on my end. As this is calling the background method on 10 000 cells, the operations are slow as they require many DOM manipulations.

I can suggest based on the expected data, to set only the first colour on the whole range, and then based on the data to only change it on the cells that are different as this will greatly reduce the numbers of times of background method is called and also the loading time:

http://dojo.telerik.com/oHuXe

I hope this will help speed up the process.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 03 Feb 2017, 07:37 AM

Hi Stefan,

Thanks for the investigation - you came to the same kind of conclusion I did. Although - your suggestion is genius. Thank you!

I will check this, and as long as the first colour applied to all cells is the one which is statistically applied more often than not with the logic, then this should help.

Thanks again

Marc

 

Tags
Spreadsheet
Asked by
Marc
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Marc
Top achievements
Rank 1
Share this question
or