locked
VS2013 LightSwitch HTML Client: Binding issue with an HTML editor... Please help! :) RRS feed

  • Question

  • Hello,

    We have an AddEditResponse screen that has a textarea.  The textarea binds to a string field in the database.  The field, "Body", holds a response to a question from the user.  We need to be able to copy-n-paste content that may include pictures and charts, so we need an HTML editor rather than the simple textarea.  I've created a render method for the textarea, and have configured the use of KendoUI's Editor.  At this point, the editor displays the data in the screen's Response.Body object. However, when I edit the text in the KendoUI editor, and hit the save button on the screen, the Response.Body object in myapp.AddEditResponse.beforeApplyChanges() still has the former data; None of my edits are in it.  So, I am wondering whether I am facing some kind of binding issue...  I would really appreciate your help and suggestions.  If there is another editor that will work easily with LS, we can switch to it, but I really prefer Kendo's components. :)

    myapp.AddEditResponse.Body_render = function (element, contentItem) {
        // Provide the place for the KendoUI editor.  

        var div = $("<div id ='responsebody' class='k-content'></div>");
        var html = $("<textarea id='texteditor' data-role='editor' data-bind='value:value'></textarea>");

        // Bind the textarea to the viewmodel, so they will be kept in sync.
        var viewModel = kendo.observable({
            value: contentItem.value
        });
        html.appendTo($(div));
        div.appendTo($(element));
        kendo.bind("#responsebody", viewModel);
    };

    Thank you for your time,

    Mike

    Friday, November 8, 2013 4:16 PM

Answers

All replies