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

Manipulating a value of textbox in grid disrupts binding

1 Answer 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
VasVas
Top achievements
Rank 1
VasVas asked on 05 Jun 2015, 01:59 PM

Dear Telerik ,

 

I have this problem I have a dynamic client side grid in which I add rows. one of the fields is a text field which represents a phone number. All input must be numeric and the length must not exceed 10 chars. so I added a templates that creates the input=text with a keyup="checkerfunction(this,maxlen);

When every the function finds that an the input is not allowed it trims the value of the text box text.value = "trimedValue";

every time the function manipulates the value there seems to be a problem in the binding of the textbox to the kendo dataSource of the grid when the row is saved the value returns to the value before the row was opened for editing when we check the value after a trim action by the function and durring the custom command handeling the saving of the row the value of the bound field in the dataSource is "" (empty string). what is the cause of all this.

 

Yours,

 

Ariel

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 09 Jun 2015, 11:26 AM
Hi,

The value binding depends on the change event in order to update the model so you should trigger it after setting the value with code in order to avoid the problem e.g.
text.value = "trimedValue";
$(text).change();


Regards,
Daniel
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
VasVas
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or