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

Column locking

1 Answer 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mark
Top achievements
Rank 1
Veteran
mark asked on 21 Apr 2020, 07:42 PM

Can we dynamically lock and unlock the columns? Is it possible to have an indicator (like an icon next to a title) that the column is currently locked?

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 23 Apr 2020, 04:12 PM

Hello Mark,

The Grid exposes the lockColumn and unlockColumn methods for locking/unlocking columns.

As for adding an indicator that the column is locked, there isn't a built-in indicator, but you can use jQuery to add an icon next to the locked column's title.

Here's an example: https://dojo.telerik.com/IsuWolEt

The "Ship Country" column is locked. In its configuration a custom class is set so that it can be later identified:

headerAttributes: {
  "class": "locked-column",
}

In the Grid's dataBound event handler, a span element that displays an icon is added to the header of the locked columns that have the custom class:

dataBound: function(e){
  $(".k-grid .locked-column").prepend("<span style='float: left' class='k-icon k-i-lock'></span>")
}

Regards,
Ivan Danchev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
mark
Top achievements
Rank 1
Veteran
Answers by
Ivan Danchev
Telerik team
Share this question
or