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

Group by column that is not in grid, but have title

4 Answers 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jaanus
Top achievements
Rank 1
Jaanus asked on 03 Apr 2019, 08:02 PM

How can I set a grouping that is not in the grid, but have a nice title.

https://dojo.telerik.com/OcUFuLom

 

I want group by school id, but that the grouping header have school name.

 

So instead of school.id: 33, I want there to be School : Test

4 Answers, 1 is accepted

Sort by
0
Jaanus
Top achievements
Rank 1
answered on 03 Apr 2019, 08:06 PM

One option is to use the school.id as column and set template and group header template, but then excel export shows IDs, instead of names.

https://dojo.telerik.com/uLUDUteM

0
Georgi
Telerik team
answered on 05 Apr 2019, 09:47 AM
Hi Jaanus,

A possible solution to apply the format to the exported file is modify the value of the cell within the excelExport event handler.

e.g.

   excelExport: function(e) {
  var sheet = e.workbook.sheets[0];
 
  for (var i = 1; i < sheet.rows.length; i++) {
    var row = sheet.rows[i];
    if(row.type ==="data"){
      row.cells[2].value = getById( row.cells[2].value)
 
    }
  }
}

Below you will find a modified version of the provided sample:



Regards,
Georgi
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.
0
Jaanus
Top achievements
Rank 1
answered on 11 Apr 2019, 06:57 PM
How would it work when columns are reorderable?
0
Georgi
Telerik team
answered on 15 Apr 2019, 07:43 AM
Hello Jaanus,

In this case I can suggest you to find the index of the column using the field name.

e.g.

var index;
 
this.columns.forEach(function (col, i) {
  if (col.field == 'school.id') {
    index = i;
  }
})
 
    row.cells[index].value = getById(row.cells[index].value)

Below you will find a modified version of the sample:



Regards,
Georgi
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
Grid
Asked by
Jaanus
Top achievements
Rank 1
Answers by
Jaanus
Top achievements
Rank 1
Georgi
Telerik team
Share this question
or