on 09-14-2014 10:18 AM
Hello Experts,
I'm having a table in my SAPUI5 application.
The table has an "Add Row" button in each row which supposed to insert a new row below the current row.
If I'm not using a formatter function it works but if I'm using a formatter there is a strange behavior, see screenshots:
1. Initial View
2. Added 2 (empty) rows
3. Enter values in the rows
4) When pressing the "+" I'm expecting that both "3" and "4" will go down but only "3" goes down.
jsbin:
http://jsbin.com/papata/1/edit?html,output
If I'll comment the formatter function it'll work.
What am I doing wrong?
Regards,
Omri
Hi Omri
I have fixed your code here. And few things
1. we are responsible to update the model if we have formatter. See the change handler that I have added
2. you do not need to bind model to table again once it is set in global. BTW, you have oTable.setModel(sap.ui.getCore().getModel("tblModel")); which is incorrect. It should be
oTable.setModel(sap.ui.getCore().getModel("tblModel"), 'tblModel') if you really wan to; Anyway, this is not need because UI5 will look it up in the global model.
Thanks
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Omri,
Try to move the formatter function next to path inside parts definition. That should fix it.
bindProperty("value", {
parts: [
{path : "tblModel>anotherText",
formatter : function(anotherText) {
if ((anotherText!=null) && (anotherText.trim().length>0)) {
return "X" + anotherText;
} else {
return anotherText;
}
}}
],
// What is wrong with the formatter?
/*formatter : function(anotherText) {
if ((anotherText!=null) && (anotherText.trim().length>0)) {
return "X" + anotherText;
} else {
return anotherText;
}
}*/
Here's the jsbin: http://jsbin.com/gikoxejagidu/1/edit
Regards,
Kimmo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.