GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added everything for Step 3: Adding the Price Formatter · wridgeu/UI5-testing@ea435e8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • webapp
    • model
      • formatter.js
    • view
      • Worklist.view.xml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎webapp/model/formatter.js‎

Copy file name to clipboardExpand all lines: webapp/model/formatter.js
+18-3Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,23 @@ sap.ui.define([], function () {
1414
}
1515
return parseFloat(sValue).toFixed(2);
1616
},
17-
priceState: function (){
18-
19-
}
17+
/**
18+
* Defines a value state based on the price
19+
*
20+
* @public
21+
* @param {number} iPrice the price of a post
22+
* @returns {string} sValue the state for the price
23+
*/
24+
priceState: function (iPrice) {
25+
if (iPrice < 50) {
26+
return "Success";
27+
} else if (iPrice >= 50 && iPrice < 250) {
28+
return "None";
29+
} else if (iPrice >= 250 && iPrice < 2000) {
30+
return "Warning";
31+
} else {
32+
return "Error";
33+
}
34+
},
2035
};
2136
});
Collapse file

‎webapp/view/Worklist.view.xml‎

Copy file name to clipboardExpand all lines: webapp/view/Worklist.view.xml
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@
3232
<cells>
3333
<ObjectIdentifier title="{Title}"/>
3434
<Text text="{Category}"/>
35-
<ObjectNumber number="{
36-
path: 'Price',
37-
formatter: '.formatter.numberUnit'
38-
}" unit="{Currency}" />
35+
<ObjectNumber number="{path: 'Price',formatter: '.formatter.numberUnit'}"
36+
state="{path: 'Price',formatter: '.formatter.priceState'}"
37+
unit="{Currency}" />
3938
</cells>
4039
</ColumnListItem>
4140
</items>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.