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

Problem with rowTemplate, altRowTemplate and detailInit properties

1 Answer 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tomas
Top achievements
Rank 1
Tomas asked on 25 Apr 2018, 02:37 PM

Hi, in the following code I am using a sample grid, setting the rowTemplate, altRowTemplate and detailInit properties.

I tested these code with 2016.3.914 in Dojo and the detail button of grid doesn't work. 

The versions in next list we show where code works and not.

 2018 R1 SP1    - 2018.1.221     DOESN'T WORK
 2016 R3 SP1    - 2016.3.1028   DOESN'T WORK
 2016 R3            - 2016.3.914     DOESN'T WORK
 2016 R2 SP2    - 2016.2.714     WORKS WELL
 2016 R2 SP1    - 2016.2.607     WORKS WELL
 2016 R2            - 2016.2.504     WORKS WELL

Currently I updated to 2016.3.914 version so the grid doesn't work.

Could are you tell me why does that occur?  and How could I solved this problem?

<div id="grid"></div>

  // 2018 R1 SP1    - 2018.1.221    DOES NOT WORK
  // 2016 R3 SP1    - 2016.3.1028   DOES NOT WORK
  // 2016 R3        - 2016.3.914    DOES NOT WORK
  // 2016 R2 SP2    - 2016.2.714    WORKS WELL
  // 2016 R2 SP1    - 2016.2.607    WORKS WELL
  // 2016 R2        - 2016.2.504    WORKS WELL
     
var parentObj = this,
rowTemplateString = '<tr class="k-master-row row" data-uid="#: uid #">' +
           '<td class="k-hierarchy-cell"> '+
             '<div class="baseBttn button-expand-schedules #:DeactivatedAll === "0/0" ? '+
          ' \"iconGreyBttn disabledBttn\" : \"iconYellowBttn\"#"><a class="k-icon k-plus" tabindex="-1"></a>'+
                                          '</div> </td>' +
           '<td>#: name #</td>' +
           '<td>#: DeactivatedAll #</td>' +
       '</tr>';
   
  var altRowTemplateString = rowTemplateString.replace('tr class="', 'tr class="k-alt ');
   
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "Deactivated"}
  ],
  rowTemplate: rowTemplateString,
  altRowTemplate: altRowTemplateString,
  dataSource: [
    {
      name: "Beverages",
      DeactivatedAll: "0/0",
      products: [
        { name: "Tea" },
        { name: "Coffee" }
      ]
    },
    {
      name: "Food",
      DeactivatedAll: "1/1",
      products: [
        { name: "Ham" },
        { name: "Bread" }
      ]
    }
  ],
  detailTemplate: 'Products: <div class="grid"></div>',
  detailInit: function(e) {
    e.detailRow.find(".grid").kendoGrid({
      dataSource: e.data.products
    });
  }
});


Thanks.

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 27 Apr 2018, 08:57 AM
Hello Tomas,

The newer versions of Kendo components are using Font icons. This is why when applying the same classes there are no icons displayed with the more recent versions. For more information on the Font Icons and the new classes that are applied please refer to the following article.


With that said, when changing the classes in the template to correspond to the ones in the latest release the Grid was working as expected on my end.


Give the modification a try and let me know how it works for you.


Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Tomas
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or