Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 9169

Two Selects one Model

$
0
0

hi all,

 

i have a JSON Model:

 

[

    {

        "ARBPL": "42",

        "WERKS": "0111",

        "KTEXT": "AUFH"

    },

    {

        "ARBPL": "47",

        "WERKS": "0111",

        "KTEXT": "text",

        "SCHICHT": [

            {

                "BEGZT": "060000"

            },

            {

                "BEGZT": "140000"

            },

            {

                "BEGZT": "220000"

            }

        ]

    },

    {

        "ARBPL": "FZ",

        "WERKS": "0111",

        "KTEXT": "RIC01Richtpresse1"

    },

    {

        "ARBPL": "FZ",

        "WERKS": "0111",

        "KTEXT": "text"

    },

    {

        "ARBPL": "PA",

        "WERKS": "0111",

        "KTEXT": "text"

    },

    {

        "ARBPL": "PO",

        "WERKS": "0111",

        "KTEXT": "text"

    }

]

 

 

 

at first selectbox i have all ARBPL. if the user select one, in the second selectmenu should be the BEGZT of a workplace. (in the json example, there are begzt values only for one ARBPL, but in future there are BEGZT at each workingplace.

 

so my first select is:

    var ItemTemplateArbplSelect = new sap.ui.core.Item({
        key : "{getLogonArbplModel>ARBPL}",
        text : {
            parts : [ "getLogonArbplModel>ARBPL", "getLogonArbplModel>KTEXT" ],
            formatter : function(ARBPL, KTEXT) { // all parameters are

 

                // strings

 

                if (ARBPL, KTEXT) {
                    return KTEXT + " - " + ARBPL;
                } else {
                    return "empty value from backend";
                }
            }
        }

 

    });
    var arbplSelect = new sap.m.Select("logon_arbplSelect", {
        items : {
            path : "getLogonArbplModel>/",
            template : ItemTemplateArbplSelect
        }
   

 

second template is:

    var ItemTemplateShiftlSelect = new sap.ui.core.Item({
        key : "{getLogonArbplModel>SCHICHT/0/BEGZT}",
        text : {
            parts : [ "getLogonArbplModel>SCHICHT/0/BEGZT"]
        }
    });
    var shiftSelect = new sap.m.Select("logon_shiftSelect", {
        items : {
            path : "getLogonArbplModel>/",
            template : ItemTemplateShiftlSelect
        }
    });

 

 

so can anybody tell me how it should work in SAPUI5 to dependency databinding?

 

thanks, Alex


Viewing all articles
Browse latest Browse all 9169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>