Skip to Content
avatar image
Former Member

Context/Paths/Binding?

Hi All,

Here's an excerpt of code from an app I'm testing out. The code is in the createContent of the view and has had the context bound to the view. All the bindings work fine and all the values are displayed as expected.

For the ActionSheet control (oCallSheet), line 38, it seems I have find the path from the root in order to properly bind to the icl_phone_number collection. Strange because all the other bindings seem to reference the correct data, which is the contact person id passed in - e.g. - line 13 displays fine, line 15 works as well.

Workaround right now is to manually pull the path ID from the view name, which I create when navigating from master to this detail page. Any insight?

        var btnCallMenu = new sap.m.Button({
            text : "{i18n>CALL}", 
            tooltip : "{i18n>CALL}",
            icon : "sap-icon://outgoing-call",
            press: function () { 
                oCallSheet.setPlacement(sap.m.PlacementType.Vertical);
                oCallSheet.setShowCancelButton(true);
                oCallSheet.openBy(this);
            }
        });
          
        var oCallButton = new sap.m.Button({
            text: "{phone}",
            icon: {
                path: "/icl_phone_type/type",
                formatter: function (fValue) {
                    switch (fValue) {
                        case 'residence':
                            return 'sap-icon://home';
                        case 'cell':
                            return 'sap-icon://iphone';
                        default:
                            return 'sap-icon://phone';
                    }
                }
            },
            press: [oController.onCall]
        }).addStyleClass("newButton");

        // CALL ACTION SHEET
        var oCallSheet = new sap.m.ActionSheet({
            placement: sap.m.PlacementType.Bottom,
            cancelButtonPress: function () {
                jQuery.sap.log.info("oCallSheet: Cancel Button Pressed");
            }
        });

        oCallSheet.bindAggregation("buttons", "/value/" + sID + "/icl_phone_number", oCallButton);

Sorry, to add, my question is, why doesn't the following work?

  oCallSheet.bindAggregation("buttons", "icl_phone_number", oCallButton);  

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Sep 25, 2015 at 11:29 PM
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Dennis Seah

      Hi Dennis,

      Please no need for apologies, your time and help is GREATLY appreciated. Unfortunately, I couldn't get the last JSBin to work, not sure how the findIndx function is supposed to work, throwing an undefined error. I think it's still a little different than what I'm trying to understand.

      I'm trying to put the project in a JSBin for better clarity, but has too many files, so gotta break it down into a simpler example.

      Basically trying to understand why every other control in my view has the right context and is able to bind properly, whereas the ActionSheet is not.