This is a migrated thread and some comments may be shown as answers.

Return input from ModalView to caller

2 Answers 79 Views
ModalView
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 21 Jan 2014, 03:18 PM
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.
vm:
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
    }
});
utils.showReject();
var showReject = function () {
        $("#reject-view").show().data().kendoMobileModalView.open();
    }
html:
<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>
            </div>
        </div>
    </div>

2 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 21 Jan 2014, 05:08 PM
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. 

Regards,
Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Thomas
Top achievements
Rank 1
answered on 21 Jan 2014, 08:20 PM
I was able to resolve the issue.

Thanks,
Tom
Tags
ModalView
Asked by
Thomas
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or