Databound foreach cell false positives

2 posts, 0 answers
  1. Lyubomir
    Lyubomir avatar
    1 posts
    Member since:
    Aug 2019

    Posted 14 Aug 2019 Link to this post

    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
  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1201 posts

    Posted 16 Aug 2019 Link to this post

    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.
Back to Top