on 02-26-2019 9:34 AM
Hello all,
I would like to modify the model and view for the demo sample which could be found on
I would like to insert a new row.
In the controller I got the following coding, which does not work
onInsert: function (oEvent) {
debugger;
1 var oModel = this.getOwnerComponent().getModel();
2 var aProperty = oModel.getProperty("/");
3 var oProperty = {
4 ProductId: "999",
5 Name: "99999Name",
6 SupplierName: "999supplierName",
7 Category: "999"
8 };
9 aProperty.push(oProperty);
10 oModel.setProperty("/", aProperty);
}
Line 1 works fine. But I do not get an array as expected. Instead I get an object 😞
Case I get an object the line 9 will not work.
The JSON-model looks:
[
{
"NodeID": 1,
"HierarchyLevel": 0,
"Description": "1",
"ParentNodeID": null,
"DrillState": "expanded"
},
{
"NodeID": 2,
"HierarchyLevel": 0,
"Description": "2",
......
My idea was now to modify the JSON-model with "Products":
{
"Products":
[{
"NodeID": 1,
"HierarchyLevel": 0,
"Description": "1",
"ParentNodeID": null,
"DrillState": "expanded"
}, {
"NodeID": 2,
"HierarchyLevel": 0,
Would that approach be ok?
If yes: After I made the modification in the Model.json there is no data visible any more?
What else do I have to modify?
?
I would be glad if anyone could help.
Regards
Mario
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.