Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
645
igDialog and Knockout js
posted

Hi,

I have a dialog with controls inside bound with Knockout. Everything works well for me except one thing: once user made some changes on dialog (like check some check boxes, type in some text) then close it, next time all the changes remain. To close the dialog, I just use this function: $("#print-dialog").igDialog("close");. Did you see this issue before and if yes, what was your solution to fix this?

FYI, my function to open the dialog follows:

function showPrintDialog(exam_id, exam_type) {

    if (print_first_time == true) {

        print_model = new printDialogViewModel(exam_id, exam_type);
        ko.applyBindings(print_model, document.getElementById('print-dialog'));

        $('#print-questions').customRadioCheck();
        $('#print-answers').customRadioCheck();
        $('#print-explanations').customRadioCheck();
        $('#print-answer-key').customRadioCheck();
        $('#print-blank-answer-sheet').customRadioCheck();

        $('#print-range-text').igTextEditor();
        $('#print-range-text').igTextEditor("option", "disabled", true);
        $('#print-exam-print-btn').igButton();
        $('#print-exam-cancel-btn').igButton();

        print_first_time = false;

    } else {
        // reinitialize the data
        print_model.Questions(true);
        print_model.Answers(true);
        print_model.Explanations(true);
        print_model.AnswerKey(false);
        print_model.BlankAnswerSheet(false);
        print_model.QuestionRangeText = ko.observable("");
        $('#print-range-text').igTextEditor("option", "disabled", true);
    }

    $("#print-dialog").igDialog("open");

    $(function () {

    });
}

Thanks in advance.

Parents Reply Children