Skip to content

Commit 87ab653

Browse files
committed
[DEMO] Use keyboard shortcuts
1 parent 38ca133 commit 87ab653

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

webapp/controller/App.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ sap.ui.define([
3838
/**
3939
* Removes all completed items from the todo list.
4040
*/
41-
clearCompleted() {
41+
onClearCompleted() {
4242
const oModel = this.getView().getModel();
4343
const aTodos = oModel.getProperty("/todos").map((oTodo) => Object.assign({}, oTodo));
4444

webapp/manifest.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
"type": "application"
66
},
77
"sap.ui5": {
8+
"commands": {
9+
"Clear": {
10+
"shortcut": "Ctrl+Y"
11+
}
12+
},
813
"dependencies": {
914
"minUI5Version": "1.121.0",
1015
"libs": {

webapp/view/App.view.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" xmlns="sap.m" xmlns:f="sap.f" controllerName="sap.ui.demo.todo.controller.App" displayBlock="true">
22
<App>
33
<Page>
4+
<dependents>
5+
<core:CommandExecution id="CE_CLEAR_COMPLETED" command="Clear" enabled="true" execute=".onClearCompleted" />
6+
</dependents>
47
<customHeader>
58
<f:ShellBar core:require="{ Helper: 'sap/ui/demo/todo/util/Helper' }" title="{i18n>TITLE}" homeIcon="{:= Helper.resolvePath('./img/logo_ui5.png') }" />
69
</customHeader>
@@ -31,7 +34,7 @@
3134
<SegmentedButtonItem text="{i18n>LABEL_COMPLETED}" key="completed"/>
3235
</items>
3336
</SegmentedButton>
34-
<Button id="clearCompleted" enabled="{/itemsRemovable}" icon="sap-icon://delete" text="{i18n>CLEAR_COMPLETED}" press=".clearCompleted"/>
37+
<Button id="clearCompleted" enabled="{/itemsRemovable}" icon="sap-icon://delete" text="{i18n>CLEAR_COMPLETED}" press="cmd:Clear"/>
3538
</OverflowToolbar>
3639
</headerToolbar>
3740
<infoToolbar>
@@ -68,7 +71,7 @@
6871
</items>
6972
</SegmentedButton>
7073
<ToolbarSpacer />
71-
<Button id="clearCompleted-footer" enabled="{/itemsRemovable}" icon="sap-icon://delete" text="{i18n>CLEAR_COMPLETED}" press=".clearCompleted"/>
74+
<Button id="clearCompleted-footer" enabled="{/itemsRemovable}" icon="sap-icon://delete" text="{i18n>CLEAR_COMPLETED}" press="cmd:Clear"/>
7275
</OverflowToolbar>
7376
</footer>
7477

0 commit comments

Comments
 (0)