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

Kendo Grid and Complex entitlement

7 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Congyuan
Top achievements
Rank 1
Congyuan asked on 17 Jan 2013, 04:30 PM
Recently we are trying to use Kendo Grid for our new project, but the problem is the entitlement is very complicated. Not sure if Kendo Grid can support that complex requirement. The requirements is like we need check some filed in row. For example we have a client table in database. In Front End we have a editable Grid to display those information, but we need disabled the some row conditionally. Is it possible to do that?  If we can how to customize it, if there are any demo code will be great.

Thank you.

7 Answers, 1 is accepted

Sort by
0
Congyuan
Top achievements
Rank 1
answered on 17 Jan 2013, 04:36 PM
One thing forget to tell you. We are using MVC3 Server side wrappers. Is it any hard to customize for that?
0
Brett
Top achievements
Rank 2
answered on 17 Jan 2013, 07:31 PM
Sorry, but it's difficult to understand what you mean or to help you without a code example.
0
Congyuan
Top achievements
Rank 1
answered on 18 Jan 2013, 01:53 PM
alright let explain it more clearly. It seems i made it hardly to understand.
In a word, if it's in inline edit mode can we disabled one cell that end user don't have that permission to edit it.
0
Accepted
Brett
Top achievements
Rank 2
answered on 18 Jan 2013, 01:58 PM
Oh, yes, that is quite easy to set up. When you configure your DataSource, each field in the schema has an editable property. If you set it to false, the user cannot edit that field. Here's a quick example:
var ds = new kendo.data.DataSource({
  data: local,
  pageSize: 10,
  schema: {
    model: {
      id: 'Id',
      fields: {
        Id: { type: 'number', editable: false, defaultValue: 0 },
        Name: {},
        Email: {}
      }
    }
  }
});
0
Congyuan
Top achievements
Rank 1
answered on 25 Jan 2013, 03:49 PM
Thanks you for your reply. Got it. I have another question about this. it looks like you disabled columns name Id in all rows. Is it possible to just make one or some of them disabled?
0
Accepted
Brett
Top achievements
Rank 2
answered on 28 Jan 2013, 01:49 PM
Yes, it is possible to do that; however, it is not a supported feature in Kendo UI. To perform the type of functionality you require, you can use a combination of CSS classes and jQuery to selectively disable input elements. So, to disable the cells you want to, add a CSS class called "disabled-cell" (or whatever you wish to call it) to a <td> element. Then, in your javascript, have jQuery select all elements with the class "disabled-cell" and disable all children <input> elements.

$('.disabled-cell').find('input').each(function() {
  this.disabled = true;
});
0
Congyuan
Top achievements
Rank 1
answered on 28 Jan 2013, 04:54 PM
ok,a little bit tricky but it should work.   Thank you so much for your help.
Tags
Grid
Asked by
Congyuan
Top achievements
Rank 1
Answers by
Congyuan
Top achievements
Rank 1
Brett
Top achievements
Rank 2
Share this question
or