cancel
Showing results for 
Search instead for 
Did you mean: 

Fragments input field empty in sapui5

Former Member
0 Kudos

Hi Experts,

I have a table in my XML view with mode as singleselectleft as below

When the customer selects one of the row and clicks on "Create Ticket" button a popup opens like

I want to display data in these fields from odata.

The code I tried for displaying the data


createticket: function(oEvent) {

  // create popover

  if (!this._oPopover1) {

  this._oPopover1 = sap.ui.xmlfragment("popoverNavCon", "CustomerPortal.Popover", this);

  this.getView().addDependent(this._oPopover1);

  }

  // delay because addDependent will do a async rerendering and the popover will immediately close without it

  var oButton = oEvent.getSource();

  jQuery.sap.delayedCall(0, this, function() {

  this._oPopover1.openBy(oButton);

  });

  },

Once these details are displayed I have to create a new ticket for the same. Please provide suggestions on how this can be accomplished.

Regards,

Srinivasan

Accepted Solutions (0)

Answers (1)

Answers (1)

saivellanki
Active Contributor
0 Kudos

Hi Srinivasan,

Just call the service and bind the data to fragment.

Will this rough sample help, I was using JSON model though: Punker

Working Snippet:

Regards,

Sai.

Former Member
0 Kudos

Hi Sai,

Thank you for your sample code. I implemented your code. Still I get empty popup. One difference I found that you have set the oModel in the onInit() whereas I have done it like


_routePatternMatched: function(oEvent) {

var sId = oEvent.getParameter("arguments").ID,

oView = this.getView(),

sPath = "/ServiceRequestCollection('" + sId + "')";

var oModel = new sap.ui.model.odata.ODataModel("/sap/c4c/odata/v1/c4codata/");

oModel.read("/ServiceRequestCollection?$filter=CustomerID eq '1001192'", {

success: function(oData, response) {

var oResult = [];

oResult = oData.results;

ibasearray = oResult;

ibasearray = {

service: ibasearray

};

var oVizFrame3Model = new sap.ui.model.json.JSONModel(ibasearray);

var oTable = oView.byId("idibaseTable");

oTable.setModel(oVizFrame3Model);

var oBinding = oTable.getBinding("items"),

oFilter;

oFilter = new Filter("ProductID", "EQ", ibasetable);

oBinding.filter([oFilter]);

}

});

oView.bindElement({

path: sPath,

events: {

dataRequested: function() {

oView.setBusy(true);

},

dataReceived: function() {

oView.setBusy(false);

}

}

});

},

Hope this is not the reason my popup appears empty. Please provide your suggestions

Regards,

Srinivasan

Former Member
0 Kudos

Hi Sai,

Any suggestions from your side would be very helpful. I am still facing the same issue.

Thanks,

Srinivasan

Former Member
0 Kudos

Hi Srini,

Hoping you get all the data (fields in create ticket ) when you attach the data to the table .. if yes than you need to just get the binding context and attach it to the dialog ,

  1. createticket: function(oEvent) { 
  2.   // create popover 
  3. var sitem = this.getView().byId("<your_table_id>").getSelectedItem();
  4. var data = sitem.getBindingContexr().getProperty();
  5.   if (!this._oPopover1) { 
  6.   this._oPopover1 = sap.ui.xmlfragment("popoverNavCon", "CustomerPortal.Popover", this); 
  7.   this.getView().addDependent(this._oPopover1); 
  8.   } 
  9. var model = new sap.ui.model.json.JsonModel();
  10. model.setData({dataSet: data});
  11. this._oPopover1.setModel(model);
  12. this._oPopover1.bindElement("/dataSet");
  13.   // delay because addDependent will do a async rerendering and the popover will immediately close without it 
  14.   var oButton = oEvent.getSource(); 
  15.   jQuery.sap.delayedCall(0, this, function() { 
  16.   this._oPopover1.openBy(oButton); 
  17.   }); 
  18.   }, 

thanks

Viplove