Right now I have a table (sap.ui.table.TreeTable) that displays lots of editable data (using sap.m.Input). This data in any given column can either be a float (sap.ui.model.type.Float) or percent (internal custom type, similar to float but shifted accordingly). Because of this we end up having 2 Inputs defined for every column, one for float and one for percent, and toggle the visibility of the input based on the model's data.
new sap.m.Input({
value: {
path: 'some/value',
type: myFloat
},
visible: {
path: 'some/type',
formatter: function (type) {
if (null !== type && undefined !== type) {
return (type !== x && type !== y);
}
return false;
}
}
}),
new sap.m.Input({
value: {
path: 'some/value',
type: myPercent
},
visible: {
path: 'some/type',
formatter: function (type) {
if (null !== type && undefined !== type) {
return (type === x || type === y);
}
return false;
}
}
})
What I would really like to do is to change the type of a single input based on the data so that I don't have twice as many inputs. So far, I haven't found a way to do this but it really seems like there must be a more elegant way to accomplish than having 2 inputs and toggling the visibility.
Any ideas?
Thank you,
Sophie