Return input from ModalView to caller

3 posts, 0 answers
  1. Thomas
    Thomas avatar
    5 posts
    Member since:
    Nov 2013

    Posted 21 Jan 2014 Link to this post

    I have a kendo view that is bound to a kendo.observable with accept and reject actions.  When reject is selected, I pop up a modalview that includes an input which requires comments as why they are rejecting.  The modal has two buttons, Reject and Cancel.  If the users hits accept, I want to send the input back to the original views viewModel.  I also expect all execution to stop when the modal is open, but it continues to run.

    Here is a snippet of the viewModel and the modal view.
    var viewModel = kendo.observable({
        accept: function () {
            // ajax call
        reject: function () {
            utils.showReject(); // modalview
            // get response from showReject (i.e., if they hit Reject,
            // give me their comments from the input)
            // ajax call with comments from above
    var showReject = function () {
    <div data-role="modalview" id="reject-view" style="display: none; width: 70%;">
            <div data-role="header">
                <div data-role="navbar">
                    <span>Are you sure?</span><br />
                    <textarea rows="3" placeholder="Enter Reject Reason" style="width: 95%; padding: 5px;"></textarea><br />
                    <a data-click="app.closeModal" data-modalid="#reject-view" data-role="button">Reject</a>
                    <a data-click="app.closeModal" data-modalid="#reject-view" data-role="button">Cancel</a>

  2. Petyo
    Petyo avatar
    2444 posts

    Posted 21 Jan 2014 Link to this post

    Hi Thomas,

    only the native browser dialogs (alert, confirm, prompt) can stop the execution of the browser thread. If this is the pattern that you are looking for, then you may consider using a prompt() call.

    If you wish to use the modalview, you can bind to the modalview buttons click events and assign the textarea value to the viewmodel in question. Alternatively call a certain method of it – this is actually a matter of your personal preference and architectural style. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Thomas
    Thomas avatar
    5 posts
    Member since:
    Nov 2013

    Posted 21 Jan 2014 Link to this post

    I was able to resolve the issue.

Back to Top