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

[Solved] validation on grid edit - close cell with message

3 Answers 792 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wit
Top achievements
Rank 1
Wit asked on 15 Oct 2014, 01:43 PM
Hi,

I have to prevent user form editing a row. I am using a custom  validation on edit event. I can validate and closeCell but I am having difficulties with  providing some feedback to user.
My grid also contains custom edit drop down, I am also having difficulties with displaying feedback for that field. 

Code example http://dojo.telerik.com/odeKI/2

I would appreciate any suggestions

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 17 Oct 2014, 08:49 AM
Hi Wit,

Basically, the Validator is used to validate input elements and display error messages related to them. Since the cell is being closed, there is no longer an input element that could be validated and there is no place where the message is to be displayed. Instead of using the Validator, I would suggest finding the row by its data-uid attribute and showing a Tooltip with the message next to the cell that was closed. Here is an example how to get the cell: 
edit: function(e){
    ...
    this.closeCell();
    var grid = this;
    setTimeout(function () {
       grid.tbody.find("tr[data-uid='"+e.model.uid+"'] td:first").css("background-color", "red");
    });
 
}


Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Wit
Top achievements
Rank 1
answered on 17 Oct 2014, 11:26 AM
Hi Alexander,
in your example you are using :
td:first

how could I get the actual column that was clicked by user ?

Thank you
0
Accepted
Alexander Popov
Telerik team
answered on 17 Oct 2014, 12:20 PM
Hi Wit,

That could be achieved using the e.container argument. For example: 
edit: function(e){
    ...
    this.closeCell();
    var grid = this;
    setTimeout(function () {
       e.container.css("background-color", "red");
    });
  
}


Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Wit
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Wit
Top achievements
Rank 1
Share this question
or