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

Databound foreach cell false positives

1 Answer 51 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Lyubomir
Top achievements
Rank 1
Lyubomir asked on 14 Aug 2019, 02:38 PM
Hello, im simulating having a datasource by generating the data with javascript and binding that to a datasource object in kendo. Could this be the issue for the false positives on column C? Im also open to other suggestions on how can i color cells  depending on their value with datasource binding
Example: https://dojo.telerik.com/UcAFowEP/3

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 16 Aug 2019, 11:11 AM
Hi Lyubomir,

The issue in question is caused by the logic in the DataBound event handler. The way each cell range is accessed should be changed to:
function databound(event) {
  let sheet = event.sender.activeSheet();
  let range = sheet.range("C2:C21");
  range.forEachCell(function(row, column, cellProperties) {
    if (cellProperties.value === true) {
      sheet.range(row, column).background("#ababab");
    }
  });
}

Note also that the range spans until the 21th row and not only to the 20th. Here you will find a modified version of the Dojo.

Regards,
Veselin Tsvetanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Spreadsheet
Asked by
Lyubomir
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or