Кун
Вот один из способов достижения этого
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title>App Title</title>
<script id="sap-ui-bootstrap"
type="text/javascript"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_belize"
data-sap-ui-libs="sap.m"
data-sap-ui-xx-bindingSyntax="complex">
</script>
<script>
sap.ui.define(["sap/m/List", "sap/m/StandardListItem", "sap/ui/model/json/JSONModel"],
function(List, StandardListItem, JSONModel) {
"use strict";
List.extend("MyList", {
metadata: {
events: {
ctrlClick: {},
shiftClick: {}
}
},
renderer: {}
});
StandardListItem.extend("MyItem", {
renderer: {},
onAfterRendering: function() {
var that = this;
var oList = this.getParent();
var cntrlIsPressed = false;
var shiftIsPressed = false;
if (StandardListItem.prototype.onAfterRendering) {
StandardListItem.prototype.onAfterRendering.apply(this, arguments);
var $this = this.$();
$this.keydown(function(event) {
cntrlIsPressed = (event.which === 17);
shiftIsPressed = (event.which === 16);
});
$this.keyup(function() {
cntrlIsPressed = false;
shiftIsPressed = false;
});
$this.click(function(event) {
if (cntrlIsPressed) {
oList.fireCtrlClick({
item: that
})
} else if (shiftIsPressed) {
oList.fireShiftClick({
item: that
})
}
});
}
}
});
var oList = new MyList({
items: {
path: "/items",
template: new MyItem({
title: "{name}"
})
},
shiftClick: function(oEvent) {
console.log(oEvent.getParameter("item"));
}
});
oList.setModel(new JSONModel({
items: [
{name: "abc" }
]
}));
oList.placeAt('content');
});
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
http://jsbin.com/jegehobehi/edit?html,output