$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
0

Combo box select SAP UI5

Oct 31, 2016 at 09:06 AM

153

avatar image

Hi!

I have some problems with Combo Box. How can I avoid repeats? I have rows where "Layout" = * and I have in Combo box many *. Another question about getting row with this Layout.

Link to scrin

https://i.imgsafe.org/7114ae3880.png

My filter doesn't work. Maybe could you tell me where is my mistake?

    },
        onChange: function(oEvent) {
            var oTable = this.getView().byId("idStats");
            // getting the value of Combobox
            oTable.setShowOverlay(true);
        },
        onReset: function(oEvent) {
            // resetting the value of Combobox and initial state of the table
            var oTable = this.getView().byId("idStats");
            var oBinding = oTable.getBinding("items");
            oBinding.filter([]);
            oTable.setShowOverlay(false);
            this.byId("oComboBox").setSelectedItem(null);
        },
        onSearch: function(oEvent) {
            var oTable = this.getView().byId("idStats");
            var comboBoxValue = this.byId("oComboBox").getValue(),
                oBinding = oTable.getBinding("items"),
                oFilter;
            if (comboBoxValue || comboBoxValue === "") {
                oTable.setShowOverlay(false);
                oFilter = new Filter("Layout", "EQ", comboBoxValue);
                oBinding.filter([oFilter]);
            }
        },

Thank you in advance!

Regards,

Khristina

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Jamie Cawley
Oct 31, 2016 at 12:29 PM
0

What is shown in the combobox is controlled by the model. So either use a distinct list provided by the service, or create a local json model containing only the distinct values. Are you seeing a call made when onSearch is fired?

Regards,

Jamie

SAP - Technology RIG

Share
10 |10000 characters needed characters left characters exceeded
Akhilesh Upadhyay Nov 01, 2016 at 04:28 PM
0

you need to check combobox entity result, you need to handle duplicate records from backend/gateway, may be you need to apply key for both key and text from gateway.

for filter:

may be extra spaces could be there, u can try combobox.getValue().trim() once OR

may be Layout field is not filterable in gateway. OR

you can try to change from combobox.getValue() to combobox.getSelectedKey() if you filter on combobox key.

Regards,

Akhilesh

Share
10 |10000 characters needed characters left characters exceeded
Khristina Filonchik Nov 07, 2016 at 10:53 AM
0

Thank you for your answers. The problem is a little bit different. I have this table with combobox. I found a way to avoid repeats. I took another value and created var itemData = new Array();

But my combobox unfortunately still doesn't work. I cannot actually this understand. getSelectedKey unfortunatelly doesn't work:(

My code

},
    onChange: function(oEvent) {
        // getting the value of Combobox
        var oTable = this.getView().byId("idStats");
        oTable.setShowOverlay(true);
    },

    onSearch: function(oEvent) {
        var oTable = this.getView().byId("idStats");
        var comboBoxValue = this.byId("oComboBox").getValue(),
            oBinding = oTable.getBinding("items"),
            oFilter;
        if (comboBoxValue || comboBoxValue === "") {
            oTable.setShowOverlay(false);
            oFilter = new sap.ui.model.Filter("Obart", "EQ", comboBoxValue);
            oBinding.filter([oFilter]);

            // getting the value of Combobox

        }
        oTable.setShowOverlay(true);

    },
    onReset: function(oEvent) {
        // resetting the value of Combobox and initial state of the table
        var oTable = this.getView().byId("idStats");
        var oBinding = oTable.getBinding("items");
        oBinding.filter([]);
        oTable.setShowOverlay(false);
        this.byId("oComboBox").setSelectedItem(null);
    },

    handleViewSettingsDialogButtonPressed: function(oEvent) {
        if (!this._oDialog) {
            this._oDialog = sap.ui.xmlfragment("Statusverwaltung3.view.Dialog", this);
        }
        // toggle compact style
        jQuery.sap.syncStyleClass("sapUiSizeCompact", this.getView(), this._oDialog);
        this._oDialog.open();

    },


fgf.png (27.8 kB)
fgf5.png (33.8 kB)
Show 2 Share
10 |10000 characters needed characters left characters exceeded

combobx or table filter is not working ?

If filter, is Obart field filterable in gateway ?

0

Obart is filterable. My combobox is a table filter. I tried to do as in this example

https://sapui5.hana.ondemand.com/sdk/explored.html#/sample/sap.m.sample.TableOutdated/preview

I choose for example KS and I should get all rows with only KS.

0