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

[Solved] Grid custom validation with dynamic arguments

1 Answer 337 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ilya
Top achievements
Rank 1
Ilya asked on 07 Nov 2014, 09:55 PM
Hi,
I need setup custom validation on grid fields dynamically,
because code processes many forms from database and
I know a set of columns only at runtime. I took Telerik's example
for checking and changed something a little bit (see index.zip) and
got the next results.
When I set name of the field statically ("ProductName") everything is OK.
When I try use in string concatenation gridColumns[i].field I get in console
message that variable is not defined. When I set fieldName = gridColumns[i].field
I don't  receive any message, I see custom validation on the column
(see kendoui-grid-custom-validator.jpg), but custom validation doesn't work.
Standard validation works (required: true).
Is it possible to use variables from closure in javascript? Or there is
another way to define it?

1 Answer, 1 is accepted

Sort by
0
Ilya
Top achievements
Rank 1
answered on 07 Nov 2014, 11:12 PM
Hi,

I resolved this question: add custom attributes to input field and then pickup in validation
function using input.attr("custom_attribute_name").
Tags
Grid
Asked by
Ilya
Top achievements
Rank 1
Answers by
Ilya
Top achievements
Rank 1
Share this question
or