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.
Hi, Tangailam.
Thanks for using our product. I just have one question to clarify if I understood you right.
When the igDialog is closed, the container is just hidden, it's not destroyed. That's why when it's opened again, the container is just shown again, and nothing of the controls, bound with Knockout, is changed. Is your expectation that all the controls are with default values? Because igDialog closing/opening is not related and should not affect the Knockout functionality.
I will wait for your feedback and sorry if I didn't understand your question.
Best regards,
Nikolay
Hi Nikolay,
Thanks for your response. I would like to clarify more about my question. As you can see in the code snippet I posted above, I have reset the values of print_model to default. My expectation is the controls will get those default values and display them correctly. I debugged and found out that my print_model was reset properly, but the controls inside igDialog didn't show those value. This did not happen when I moved the controls outside igDialog. That's why I have to ask you for your support.
I hope this will help you understand my question better.
Thanks.