locked
Updating the HTML client's TextBox as PropertyChanged (keydown) RRS feed

  • Question

  • We're working with the HTML client and, in certain cases, we'd like to update the binding targets as the text is entered in the TextBox control rather than on the LostFocus of the control. 

    This would work in a similar fashion to using the XAML UpdateSourceTrigger.PropertyChanged rather than UpdateSourceTrigger.LostFocus.

    Has anyone implemented this before or do you have any suggestions as to the best approach (before we dive into looking at the msls.js) ?

    Thanks in advance,

    Chris

    Friday, February 6, 2015 11:24 AM

Answers

  • Thanks for the suggestions.

    I ended up going with the following approach which seems to do the trick: -

    myapp.AddEditJobScheduleDateWorkDetail.JobDescriptionTextArea_postRender = function (element, contentItem) {
        contentItem.dataBind("_view.isRendered", function (isRendered) {
            if (isRendered) {
                var tb = contentItem._view.underlyingControl;
                tb.getView().on("keyup", ".id-element", null, function (e) {
                    tb.text = tb._textElement.val();
                });
                contentItem.dataBind("value", function (value) {
                    toastr.info("JobDescriptionTextArea value [" + value + "]");
                });
            }
        });
    };
    

    Thanks,

    Chris

    • Marked as answer by Angie Xu Monday, February 9, 2015 7:27 AM
    Saturday, February 7, 2015 2:03 PM

All replies