Skip to Content

Binding Items in a Dialog ...

Hi, i'm trying to bind items in my fragment..

the table in my main view is like this...

_loadContent: function(context) {
        let tbGenerations = this.getView().byId("tbGenerations");
        let template = tbGenerations.getBindingInfo("items").template;

        let path =
          "gia_es_odata>/CONTROLE_TELA_PARAM(P_MANDT='" +
          context.MANDT +
          "',P_ORGSTR='" +
          context.ORGSTR +
          "',P_PERIODO='" +
          context.PERIODO +
          "',P_ANO='" +
          context.ANO +
          "')/Results";

        return new Promise((resolve, reject) => {
          tbGenerations.bindItems(path, template);

          tbGenerations.getBinding("items").attachChange(() => {
            resolve();
          });
        });

I want to do almost the same thing on the fragment.. how I do that?

_onHistory: function(context) {
    ...
}

Thank you .

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Feb 13 at 02:30 PM

    what's your problem?

    don't know where to write code?

    Add comment
    10|10000 characters needed characters exceeded

    • I dont know what to do to the data appears on the fragment

      This is my btn event to open dialog ..

      _onHistory: function(oEvent) {
              let tbHistory = this.getView().byId("tbHistory");
              let template = tbHistory.getBindingInfo("items").template;
      
              let path =
                "gia_es_odata>/CONTROLE_TELA_PARAM(P_MANDT='" +
                context.MANDT +
                "',P_ORGSTR='" +
                context.ORGSTR +
                "',P_PERIODO='" +
                context.PERIODO +
                "',P_ANO='" +
                context.ANO +
                "')/Results";
      
              return new Promise((resolve, reject) => {
                  tbHistory.bindItems(path, template);
      
                  tbHistory.getBinding("items").attachChange(() => {
                  resolve();
                });
              });
      
              if (!this._oHistoryDialog) {
                this._oHistoryDialog = sap.ui.xmlfragment(
                  "tax4b.gia_es.ui.view.HistoricoGeracao",
                  this
                );
                this.getView().addDependent(this._oHistoryDialog);
              }
      
              this._oHistoryDialog.open(oEvent.getSource());
            },
      
      
  • Feb 13 at 02:59 PM

    Hi Carlos,

    The controller will be the same for the fragment. Look at the official doc:
    https://sapui5.hana.ondemand.com/#/topic/4da72985139b4b83b5f1c1e0c0d2ed5a

    Add comment
    10|10000 characters needed characters exceeded