I have custom template like below
schema: {
model: {
id: 'ID',
fields: {
myField: {
{
validation: { required: true,
myfieldvalidation: function (input) {
//Some logic goes here.
input.attr("data-myfieldvalidation-msg", "This is not good");
return false;
}
}
}
}
}}}
and field declaration as
{field: "myField", template: function (dataItem) { return BuildInput(dataItem)}, title: "myField Value"}
calling following function as need logic to build textarea or to show read only. Calling following function just to clear code.
function BuildInput(dataObject) {
if(editAllowed) {
return ('<textarea rows="3" cols="4" type="text" class="k-input k-textbox " name="myField " data-bind="value:myField " ></textarea>');
} else {
return dataObject.myField ;
}
}
This textarea and binding works perfectly. But when I add validation like added above. On blur textarea is changing to input field which I don't want.
How to add validation in Kendo Grid with textArea template.
I have seen this: http://demos.telerik.com/kendo-ui/grid/editing-custom-validation
but above example deals only with input type not textarea.
Moreover, I can workaround with onchange function on textarea but, onBlur Kendo is regenerating TD content so I can't use my external function to add error message there.