sapui5 - sap.m.Input textFormatter not called -
i gained little experience open ui5 , managed create otable, bind jsonmodel , display data. facing problem, cannot find info after googling around quite while.
what want achieve: need format data shown in 1 particular column, has sap.m.input template. need take value, modify little if condition met , display result.
what have done far: mvc project , have created following things:
var omodel = new sap.ui.model.json.jsonmodel({ rows: givendatafrommvccontroller });
sap.ui.getcore().setmodel(omodel, 'modelname123');
var otable = new sap.ui.table.table({...});
otable.addcolumn(new sap.ui.table.column(colprops));
repeated multiple times
now column, format value, following:
colprops = { label: new sap.ui.commons.label({ text: 'someheader' }), template: new sap.m.input(inputargs), tooltip: 'popupmessage' };
and inputargs are:
var inputargs = { minwidth: mincolwidth, editable: iseditable, change: function (icevent) { //debugger; //... }, livechange: function (ilcevent) { debugger; //... } };
after that, bind column this:
var modelname = 'modelname123'; var colname = 'someprop'; inputargs.value = "{" + modelname + ">" + colname + "}";
i read the documentation , according it, should able sth this:
inputargs.textformatter = function (value) { debugger; var res = value; if (somecondition) { res += ' condition met!'; } debugger; return res; };
the problem: formatter function not called (none of breakpoints ever hit) of rows in table.
what have tried:
inputargs.value = { path: "{" + modelname + ">" + colname + "}", formatter: function (a, b, c) { debugger; } };
with option data-sap-ui-xx-bindingsyntax="complex"
added js tag include openui5 lib. has set: src="https://openui5.hana.ondemand.com/1.44.4/resources/sap-ui-core.js"
. use version, because there bug in newer versions (to select row in table, have click somewhere near left/right border of cells of row).
i tried this:
var theinput = new sap.m.input(inputargs); theinput.settextformatter(function (value) { debugger; var res = value; if (somecondition) { res += ' condition met!'; } debugger; return res; }); colprops = { label: new sap.ui.commons.label({ text: 'someheader' }), template: theinput, tooltip: 'popupmessage' };
this has no effect. grateful offered or pieces of advice. thank you!
Comments
Post a Comment