如何扩展 sap.m.ColumnListItem
How to extend sap.m.ColumnListItem
我想编写自己的 ColumnListItem 控件来添加拖放功能。
到目前为止我已经这样做了:
$.sap.require('sap.m.ColumnListItem');
$.sap.declare('my.DraggableDelegate');
$.sap.declare('my.ColumnListItem');
my.DraggableDelegate = function(oControl) {
this.oControl = oControl;
};
my.DraggableDelegate.prototype = {
onAfterRendering: function() {
this.oControl.$().draggable({
cancel: false
});
}
};
sap.m.ColumnListItem.extend("my.ColumnListItem", {
renderer : {}, // actually I would rather like to get the ColumnListItem renderer but I don't know how ...
init: function() {
this.oDraggable = new my.DraggableDelegate(this);
this.addDelegate(this.oDraggable);
}
// something is still missing here I guess
});
开发者控制台returns只有一个错误:
Uncaught TypeError: Cannot read property 'forEach' of undefined
有谁知道如何正确扩展 sap.m.ColumnListItem 控件?
感谢 hirse,我找到了缺失的行:
sap.m.ColumnListItem.extend("my.ColumnListItem", {
renderer : {},
init: function() {
/*******/sap.m.ColumnListItem.prototype.init.apply(this); /******/
this.oDraggable = new my.DraggableDelegate(this);
this.addDelegate(this.oDraggable);
}
});
我想编写自己的 ColumnListItem 控件来添加拖放功能。
到目前为止我已经这样做了:
$.sap.require('sap.m.ColumnListItem');
$.sap.declare('my.DraggableDelegate');
$.sap.declare('my.ColumnListItem');
my.DraggableDelegate = function(oControl) {
this.oControl = oControl;
};
my.DraggableDelegate.prototype = {
onAfterRendering: function() {
this.oControl.$().draggable({
cancel: false
});
}
};
sap.m.ColumnListItem.extend("my.ColumnListItem", {
renderer : {}, // actually I would rather like to get the ColumnListItem renderer but I don't know how ...
init: function() {
this.oDraggable = new my.DraggableDelegate(this);
this.addDelegate(this.oDraggable);
}
// something is still missing here I guess
});
开发者控制台returns只有一个错误:
Uncaught TypeError: Cannot read property 'forEach' of undefined
有谁知道如何正确扩展 sap.m.ColumnListItem 控件?
感谢 hirse,我找到了缺失的行:
sap.m.ColumnListItem.extend("my.ColumnListItem", {
renderer : {},
init: function() {
/*******/sap.m.ColumnListItem.prototype.init.apply(this); /******/
this.oDraggable = new my.DraggableDelegate(this);
this.addDelegate(this.oDraggable);
}
});