This is a migrated thread and some comments may be shown as answers.
Grid - Columns.Selectable - Title and Disable on certain rows
3 Answers 192 Views
This is a migrated thread and some comments may be shown as answers.
Surjeet
Top achievements
Rank 1
Surjeet asked on 16 Aug 2018, 04:32 PM

 Hi,

  I have tried looking through documentation and searching online, but have not found an answer to this.

  Taking the example at:  https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.selectable

  How could I change the code to satisfy these two requests:

    1.  Show a title in the header "Select Rows"

    2.  If the name is "John Doe", the row should not be selectable, and instead of the checkbox, I would like to see the name "John Doe".

 

Thanks.

 

 

3 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 20 Aug 2018, 01:03 PM
Hi Surjeet,

A possible solution to set a title is to use a headerTemplate.

Furthermore you can disable any checkbox via CSS.

Below you will find a small sample which demonstrates both of the above approaches:



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
Surjeet
Top achievements
Rank 1
answered on 24 Aug 2018, 05:51 PM

Thanks.  The code helps a lot.  However, one part is still missing

"2.  If the name is "John Doe", the row should not be selectable, and
instead of the checkbox, I would like to see the name "John Doe"."

  How could I change the value of the column to show "John Doe" instead of the checkbox

 

 

0
Georgi
Telerik team
answered on 28 Aug 2018, 12:33 PM
Hi Surjeet,

A possible solution is to iterate through the rows and check for the name within the dataBound event handler.

e.g.

dataBound:function(){
  var grid = this;
   
  grid.tbody.find('tr').each(function(){
    var row = $(this);
    var dataItem = grid.dataItem(row);
     
    if(dataItem.name === 'John Doe'){
      row.find('td').eq(0).html(dataItem.name)
    }
     
  })
}

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
Surjeet
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Surjeet
Top achievements
Rank 1
Share this question
or