Skip to Content

How to bind select control to two different path based on a condition?

I am trying to bind the slect control to two different paths in sapui5 application.
Here is my code:
<Select id="QuotePartnerSelect" forceSelection="false" change="onSelectRole" items="{= ${/PROCESS_TYPE} === 'ZK01' ? ${path:'HarmonyConfig>/PLACEHOLDERS/QuotationCloudPartner/PARVW'} : ${path:'HarmonyConfig>/PLACEHOLDERS/QuotationERPPartner/ERP_PARVW'} }" selectedKey="{path:'ROLE'}"> <core:Item key="{path: 'HarmonyConfig>KEY'}" text="{parts : [{path: 'HarmonyConfig>VALUE'}, {path: 'HarmonyConfig>FIELD_NAME'}], formatter: '.formatter.selectDeafultText' }"/> </Select>

I looked in the developer guide for complex experession binding but i I get the error of w.push is not a function. any help would be appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Nov 01, 2016 at 04:19 PM


    in the error you are getting, What is w in w.push? I mean, have you defined any object with name "w"?do you have any code, which does a Push,in your controllers?



    Add comment
    10|10000 characters needed characters exceeded

    • I think the error is due to some problem in the binding of items in select control. I am using the same syntax for text controlaand maybe there is a different way to bind items based on condition. I was thinking if someone could correct my syntax for binding in select control. I will try to debug from where this w.push is coming. The issue is these xml views getloaded initially so error comes form data.js files and it is difficult to understand. I will try to find out form where is this w.push getting called.

  • Nov 01, 2016 at 06:51 PM

    I think conditional path you cannot set using expression binding.

    you can try this from controller file inside routeMatched or bindingChange function of view, as

    if(oModel.getProperty('/PROCESS_TYPE') == 'ZK01')

    sPath = 'HarmonyConfig>/PLACEHOLDERS/QuotationCloudPartner/PARVW'


    sPath = 'HarmonyConfig>/PLACEHOLDERS/QuotationERPPartner/ERP_PARVW'

    and then

    oSelect.bindItem(sPath,oTemplate) //oTemplate = this.byId(id of core:Item of select control).clone()

    hope this helps.



    Add comment
    10|10000 characters needed characters exceeded

  • Nov 02, 2016 at 02:17 PM

    I don't think you can do that with expression binding

    the combobox is used in table, i want to bind it dynamically, i put a formatter in tooltip to manipulate the item binding

    <comm:ComboBox tooltip="{path:'ViewModel>ATTNAME',formatter:'com.****util.Util.getItems'}" > </comm:ComboBox>

    Add comment
    10|10000 characters needed characters exceeded