sap.m.Inputのカスタム拡張を作成しました。 onAfterRenderingでは、私は次のようにjquery-maskmoneyを使用して使用して値をマスクする:拡張sap.m.Input:onAfterRenderingメソッドが機能しません
$('#'+this.getId()+'-inner').maskMoney({ thousands : '', decimal : '.' });'
私はコンソールにマスクを適用すると、すべてが正常に動作します。
amountInputControl.setValue(data.amount); // Its is an instance of NumericInput
エラー:
TypeError: Cannot read property 'val' of undefined
at sap.m.InputBase._getInputValue (InputBase.js:9)
at sap.m.InputBase.updateDomValue (InputBase.js:32)
at sap.m.InputBase.setValue (InputBase.js:34)
at sap.ui.controller.updateFieldsForReference //Here was executed operation setValue
NumericInput.js
jQuery.sap.declare("control.customInputTypes.NumericInput");
sap.ui.define(['jquery.sap.global', 'sap/m/Input'],
function(jQuery, BaseInput) {
"use strict";
var commonControlInput = BaseInput.extend('control.customInputTypes.NumericInput', /** @lends sap.m.Input.prototype */ {
metadata: {},
renderer : {
render : function(oRm, oControl) {
sap.m.InputRenderer.render(oRm, oControl);
}
}
});
commonControlInput.prototype.onAfterRendering = function() {
$('#'+this.getId()+'-inner').maskMoney({ thousands : '', decimal : '.' });
};
return commonControlInput;
}, /* bExport= */ true);
を私はsetValueのにしようとしているとき、私は しようとすると、しかしonAfterRendering方法でそれを追加し、私は若干の誤差が出ます私はInputBaseクラスに触れなかったので何が間違っているのだろうか?私はこのマスクを適用しない場合、すべて正常に動作します。 コントロールのonAfterRenderingメソッドでjQueryを使用できない場合がありますか?
あなたはSAPUI5バージョンとjQuery-maskmoneyバージョンについて言及できますか?私はあなたのコードを試したが、何の問題に直面しなかった。 –