0
votes

I'm trying to do odata binding on tableselectdialog. For some reasons, I am finding it hard to make a fragment using SAP WEB IDE so I did not use fragments for the dialog and just made the dialog on the controller. Assuming that most of the properties of table can be seen on tableselectdialog, I was expecting that I will not encounter any errors. I was able to bind my odata on a table. But when I implemented a tableselectdialog, the data binding doesn't seem to work. Can anyone help me solve this error. Below is my code.

A combobox calls the event press with the method handleAddressType. The odata I'm using is /sap/opu/odata/srmnxp/UTIL

handleAddressType: function(oEvent) {
    alert(oEvent.oSource.getSelectedKey());
    var selectedAddressKey = oEvent.oSource.getSelectedKey();
    var otableSelectDialog = new sap.m.TableSelectDialog("tableSelectD", {
        noDataText: "No Address Found",
        title: "Select Address",
        columns: [
            new sap.m.Column({
                header: new sap.m.Label({
                    text: "AddressNo"
                })
            }),
            new sap.m.Column({
                header: new sap.m.Label({
                    text: "Name"
                })
            }),
            new sap.m.Column({
                header: new sap.m.Label({
                    text: "City"
                })
            }),
            new sap.m.Column({
                header: new sap.m.Label({
                    text: "Country"
                })
            })
        ],
        items: {
            path: "/",
            template: new sap.m.ColumnListItem({
                cells: [
                    new sap.m.Text({
                        text: "{UTIL>AddressNo}"
                    }),
                    new sap.m.Text({
                        text: "{UTIL>Name}"
                    }),
                    new sap.m.Text({
                        text: "{UTIL>City}"
                    }),
                    new sap.m.Text({
                        text: "{UTIL>Country}"
                    })
                ]
            })
        }
    });
    otableSelectDialog.bindAggregation("items", "UTIL>/ShipToAddressCollection?$filter=Addrtype%20eq%20%27" + selectedAddressKey + "%27",
        new sap.m.ColumnListItem({
            cells: [
                new sap.m.Text({
                    text: "{UTIL>AddressNo}"
                }),
                new sap.m.Text({
                    text: "{UTIL>Name}"
                }),
                new sap.m.Text({
                    text: "{UTIL>City}"
                }),
                new sap.m.Text({
                    text: "{UTIL>Country}"
                })
            ]
        }));
    otableSelectDialog.open();
}

Thank you in advance

1

1 Answers

0
votes

Where is the named model "UTIL" set? Is it on the view, the Component, on a control? Is it set via manifest.json or manually? If manually, please show how exactly...

Furthermore, your binding path looks a little strange:

path : "/", 

What EntitySet is "/" supposed to be? Furthermore, you are using the named model "UTIL" in the rest of the code which is also missing in the binding path. So I guess the binding path should look something like this in your case:

path : "UTIL>/MyEntitySet",

Of course you have to replace "/MyEntitySet" with whatever fits in your case. This only works if the service at "sap/opu/odata/srmnxp/UTIL" is a named model "UTIL". However, this "UTIL" named model has nothing to do with the "UTIL" in the URL string "sap/opu/odata/srmnxp/UTIL".