-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added everything for Step 5: Adding a Flag Button
- Loading branch information
Showing
5 changed files
with
59 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,39 @@ | ||
sap.ui.define([ | ||
"sap/ui/model/SimpleType" | ||
], function (SimpleType) { | ||
"use strict"; | ||
//Use data types if you need both formatting and parsing of a model value (two way instead of formatting - one way) | ||
return SimpleType.extend("com.mrb.UI5-Testing.model.FlaggedType", { | ||
//formats a model value to be displayed in the UI | ||
formatValue: function () { | ||
}, | ||
//parses a UI value to be stored in the model | ||
parseValue: function () { | ||
}, | ||
//checks a value for displaying validation errors | ||
validateValue: function () { | ||
} | ||
}); | ||
}); | ||
sap.ui.define(["sap/ui/model/SimpleType"], function (SimpleType) { | ||
"use strict"; | ||
//Use data types if you need both formatting and parsing of a model value (two way instead of formatting - one way) | ||
return SimpleType.extend("com.mrb.UI5-Testing.model.FlaggedType", { | ||
/** | ||
* Formats the integer value from the model to a boolean for the pressed state of the flagged button | ||
* General: "formats a model value to be displayed in the UI" | ||
* @public | ||
* @param {number} iFlagged the integer value of the formatted property | ||
* @returns {boolean} 1 means true, all other numbers means false | ||
*/ | ||
formatValue: function (iFlagged) { | ||
return iFlagged === 1; | ||
}, | ||
/** | ||
* Parses a boolean value from the property to an integer | ||
* General: "parses a UI value to be stored in the model" | ||
* @public | ||
* @param {boolean} bFlagged true means flagged, false means not flagged | ||
* @returns {number} true means 1 , false means 0 | ||
*/ | ||
parseValue: function (bFlagged) { | ||
if (bFlagged) { | ||
return 1; | ||
} | ||
return 0; | ||
}, | ||
/** | ||
* Validates the value to be parsed | ||
* General: checks a value for displaying validation errors | ||
* @public | ||
* Since there is only true and false, no client side validation is required | ||
* @returns {boolean} true | ||
*/ | ||
validateValue: function () { | ||
return true; | ||
}, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters