Skip to content

Commit 19ee93f

Browse files
authored
added dirty custom control (#19)
1 parent a0de17d commit 19ee93f

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

test/index.html

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,31 @@
451451

452452
}
453453
);
454+
if (!z2ui5.Dirty) { sap.ui.define("z2ui5/Dirty" , ["sap/ui/core/Control"], (Control)=>{
455+
"use strict";
456+
return Control.extend("z2ui5.Dirty", {
457+
metadata: {
458+
properties: {
459+
isDirty: {
460+
type: "string"
461+
},
462+
}
463+
},
464+
setIsDirty(val) {
465+
// var dirty = !!sap.z2ui5.oResponse.PARAMS?.DIRTY;
466+
if (sap.ushell?.Container) {
467+
sap.ushell.Container.setDirtyFlag(val);
468+
} else {
469+
window.onbeforeunload = function (e) {
470+
if (val) {
471+
e.preventDefault();
472+
}
473+
}
474+
}
475+
},
476+
renderer(oRm, oControl) {}
477+
});
478+
}); }
454479
sap.ui.define("z2ui5/Timer" , [
455480
"sap/ui/core/Control"
456481
], (Control) => {
@@ -1229,4 +1254,4 @@
12291254
});
12301255
}
12311256
</script>
1232-
<abc/></body></html>
1257+
<abc/></body></html>

0 commit comments

Comments
 (0)