How does editor get value from custom editor

7 posts, 1 answers
  1. Ed
    Ed avatar
    168 posts
    Member since:
    Sep 2013

    Posted 01 Mar 2016 Link to this post

    I am doing inline editing in my grid and one of the columns has a custom editor. The control for this column varies based on the entered values of some other columns (this column is disabled until other column values entered.) This all works great, but when I save the row, the value isn't retrieved. How is the value from a custom editor retrieved?

    When I edit the row, the editor for this cell is really just a placeholder div. Once the prerequisite columns have their values entered, I insert additional HTML into this div and instantiate the appropriate control (datePicker, dropDownList, multiSelect, numericTextBox, text input)

    The only hint as to how this works is in this demo, which states:

    • The value of this field points to a JavaScript function which instantiates the column editor for the corresponding column cells

    Thanks,

    --Ed

  2. Ed
    Ed avatar
    168 posts
    Member since:
    Sep 2013

    Posted 01 Mar 2016 in reply to Ed Link to this post

    nevermind. figured it out. I had the data-bind attribute in there, but not in the initial fragment added to the container. Once I put that fragment with the data-bind attribute in there, it worked.
  3. Ed
    Ed avatar
    168 posts
    Member since:
    Sep 2013

    Posted 01 Mar 2016 in reply to Ed Link to this post

    Back again... I was able to figure out the data-bind issue, but now that I'm swapping out one kendo control for another, even though I'm doing a kendo.destroy() on the td in the grid, I still have remnants of prior controls. If I do an empty in the td then append the fragment with the data-bind, it loses the ability to get the value from the control.

    Any recommendations?

  4. Ed
    Ed avatar
    168 posts
    Member since:
    Sep 2013

    Posted 01 Mar 2016 in reply to Ed Link to this post

    back again on the data-bind issue. When the editor is the dropDownList, I'll want the value to be "dataValueField - dataTextField". Currently, it's only coming in as the dataValueField (using data-bind="value:<column field>"). I'm not sure how to get the data in the grid from the dropDownList in the proper format.
  5. Answer
    T. Tsonev
    Admin
    T. Tsonev avatar
    2831 posts

    Posted 04 Mar 2016 Link to this post

    Hi,

    The principle of operation of the edit forms is described in detail in the Editing Functionality help article.

    In your case the editors are very dynamic and might benefit from setting the value manually in the edit event.

    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Ed
    Ed avatar
    168 posts
    Member since:
    Sep 2013

    Posted 04 Mar 2016 in reply to T. Tsonev Link to this post

    Manually binding to the currently edited model works - at least for the "changing edit widget type" issue.

    When I swap widgets, do a kendo.destoy on that td, then re-insert the div with the data-bind="value:<field>", I manually bind like so:

    var grid = $("#grid").data("kendoGrid");
    var model = grid.editable.options.model;
    kendo.bind($("#value-container"), model);

    Is this what you were referring to?

    Thanks,

    --Ed

  7. T. Tsonev
    Admin
    T. Tsonev avatar
    2831 posts

    Posted 08 Mar 2016 Link to this post

    Hello,

    Re-initializing the binding should work, as it will properly dispose of existing bindings.

    Let me know if you encounter any problems with that.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top