Skip to Content

Access custom field in sap.m.table with odata base

Hey everyone,

I'm facing a problem working with a table in SAP UI5. Most of the data shown is received by odata. But we require some input fields for further processing.

Adding them is pretty easy but I have no clue how to access them later. For example I have to filter whether the fields are filled or not.

Usually i would head for a filter on the model, but the model only contains data of the odata service.

Any ideas?

Thank you in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 07 at 02:11 PM

    Hi,

    Have you looked here? If this does not suffice please add you code and all the data needed or better yet a working example like here .

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 07 at 04:08 PM

    Hi,

    I have a JSFiddle that does something similar, in liveChange handler i check the value and apply the filter on model.

    In your case, you can create a button handler and with a cycle of items aggregation of your table and check the value of the input cell.

    handleLiveChange: function (event) {
        if (event.getParameter("newValue") !== "filter") return;
        var oRow = event.getSource().getParent();
        var filterValue = oRow.getCells()[0].getText();
        if (filterValue) {
          var oFilter = new sap.ui.model.Filter("CustomerID", sap.ui.model.FilterOperator.NE, filterValue);
          var oTable = this.getView().byId("testTable");
          var item = oTable.getItems()[0];
          var oItemTemplate = item.clone();
          oTable.unbindAggregation("items");
          oTable.bindAggregation("items", {path:"/Customers", template:oItemTemplate, filters:[oFilter]});
          //oTable.getBinding('items').filter([oFilter]);
          //event.getSource().setValue('');
        }
    }
    
    Add comment
    10|10000 characters needed characters exceeded