Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3116

Re: How to bind the JSON response of an xsjs service to the sapui5?

$
0
0

Okay Sergio. I have tried the below code.

 

But still its not working. Moreover, the web page is coming as blank. Please take a look and let me know where am I going wrong :

 

createContent : function(oController) {

 

 

  var mlayout = new sap.ui.commons.layout.MatrixLayout({

  width : "auto"

  });

  var lblName = new sap.ui.commons.Label();

  lblName.setText(" Enter the Calculation View:");

  var name = new sap.ui.commons.TextField("CVName");

  var result = new sap.ui.commons.TextField("result");

  var submitButton = new sap.ui.commons.Button({

  id : "btnSubmit",

  text : "Submit",

  press : function(oEvent) {

  count(oEvent);

  }

  });

  function count(oEvent, name) {

  var url = window.location.origin

  + "/a_practice/services/getScreen.xsjs?cvName=" + cvName;

 

 

  jQuery.ajax({

  url : url,

  type : "GET",

  contentType : "application/json;charset=utf-8",

  dataType : "json",

  success : this.onComplete,

  error : this.onErrorCall

  });

  }

  ;

 

 

  function onComplete(myTxt) {

  var oResult = sap.ui.getCore().byId("result");

  if (myTxt == undefined) {

  oResult.setText(0);

  } else {

 

 

  oResult.setText(myTxt);

  }

  // oResult.setText(oNumberFormat.format(myTxt)); }

  }

  ;

 

 

  function onErrorCall(jqXHR, textStatus, errorThrown) {

  alert("undefined")

  }

  ;

 

 

  debugger;

  mlayout.createRow(lblName, name, result, submitButton);

  return mlayout;

  }

 

Thanks,

Maneesha


Viewing all articles
Browse latest Browse all 3116

Trending Articles