javascript - Radio buttons inside Kendo grid -


In my condo grid I need three radio buttons which are tied to my data source and are inline editable. The problem is the editor when I click on a column (and I make a div wall to force the editor to call), then the value for the editor editor is not set correctly. When I click on one column and the other column, the value is not saved. And if I click on the second line for the same column, the name (radio group) is not set correctly (two editor lines of the same name). Is there any way to treat the editor correctly?

I have been using javascript to define the following grid:

1 Edit: I created a template for some added extended readability And line-breaks in the editor but they should not be present in the code.

Edit 2: Fixed error in input tag validation.

  & lt; Html & gt; & Lt ;! - Head code - & gt; & Lt; Body & gt; & Lt; div id = "grid" & gt; & Lt; / Div & gt; & Lt; Script & gt; $ {Document} .ready (function () {var grid = $ ("grid") .cendo grid ({dataSource: [{id: 1, name: "john", duration: "f"}, {id: 2 True, Columns: [[Field: "Name", Title: "First Name"}, {Field: "Duration", Title: "Duration", "Merry", Duration: "S"}] Duration: "S" Template: '& lt; div style = "position: relative"> input type = "radio" name = "group #: id #" value = "f" # = period == "f"? Check = "check ":" "First of all the input type =" radio "name =" group #: id # "value =" S "# = period ==" s "? Check =" check ":" # / "Gt; second & lt; input type =" Id = "name =" group #: id # "value =" t "# = period ==" t "? Check =" checked ":" "# /> third 
; First, lieutenant; input type = "radio" name = "group #: id # editor" value = "S" # = period == "s"? Check = "checked": "" # /> Second & lt; Input type = "radio" name = "group #: id # editor" value = "t" # = period == "s"? Check = "checked": "" # /> Third '}]}); } & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;

You use the MVVM in your editor template to bind the current field at present Editable: True, the selected radio button ({data: 1, name: "John", duration: "F"}, {id: 2, name: "<" "Mary", duration: "s"}] Columns: [{Field: "Name", Title: "First Name"}, {Field: "Period", Template: "Label" First '+' label & gt; Other & Lt; Input disabled type = 'radio' value = '#: duration #' # = period == 's'? 'Check': "# #", editor: "labels" & Lt; input name = 'duration' type = 'radio' data-bound = 'check': duration = 'f' & gt; "+" label & gt; second & lt; input name = 'duration' Type = 'radio' data-bind = 'checked': duration 'value =' s' & gt; ", title:" duration "}]});

The demo is:

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -