Hi,
I Created Tabs using
<div data-bind="compose: { model: activeTabView, activate:true, activationData: { $data }}"></div>
its working fine, but when am trying to implement canDeactivate method to prompt message for unsaved data changes while user trying to move from one tab to another tab. I am getting alert but it moving to another tab even after clicking "No".
self.canDeactivate = function () {
var ischanged = false;
for (var i = 0; self.loggedEquipment() != null && i <self.loggedEquipment().length && !ischanged; i++) {
ischanged = (self.loggedEquipment()[i].quantity.isDirty() || self.loggedEquipment()[i].regularHours.isDirty() || self.loggedEquipment()[i].overtimeHours.isDirty() || self.loggedEquipment()[i].extraWorkHours.isDirty());
}
if (ischanged)
return app.showMessage('You have unsaved data. Are you sure you want to close?', 'Unsaved Data', ['Yes', 'No']);
else
return !ischanged;
};
please can any one help me on this.
Thanks
karthik