cancel
Showing results for 
Search instead for 
Did you mean: 

Taking values from a table in UI5 and passing to backend

Former Member
0 Kudos

Hi all,

I am new to UI5 and got to work on a survey portal which accepts survey inputs from user. I have designed as below:

I have  a dataset for questions:

var qData = [

           

              //q1:document.write('<font color = "red">Compeleteness of deliverables</font>' + " related to business and system requirements"},

              {Question:"Compeleteness of deliverables related to business and system requirements",rating:"",remarks:""},

              {Question:"Quality of the product delivered Defect-free, " +

              "Performance, Ease of Use and Maintenance Portability, Scalability",rating:"",remarks:""},

              {Question: "Quality of documentation",rating:"",remarks:""},

              {Question: "Risk/Issue Management capability",rating:"",remarks:""},

              {Question:"Adherence to Service Level Agreements (SLA) including On-time delivery",rating:"",remarks:""},

              {Question: "Proactive communication on Progress",rating:"",remarks:""},

              {Question: "Delivery within the committed cost",rating:"",remarks:""},

              {Question: "Handling transition of resources",rating:"",remarks:""},

              {Question: "Commitment demonstrated by xxx team",rating:"",remarks:""},

              {Question: "xxx team adapting to your culture",rating:"",remarks:""},

              {Question: "Ability/Effectiveness of Verbal communication",rating:"",remarks:""},

              {Question: "Ability/Effectiveness of Written communication",rating:"",remarks:""},

              {Question: "Domain knowledge",rating:"",remarks:""},

              {Question: "Technical expertise (Technical platform, Architecture, Tools and techniques)",rating:"",remarks:""},

              {Question: "Overall Satisfaction",rating:"",remarks:""}

                                     

              ];

And I have binded the table:

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

            oModel.setData({modelData: qData});

         oTable.setModel(oModel);

       oTable.bindRows("/modelData");

But actually I need to bind the text fields to pass these data to back end right? But how can I set another model to a table where I have already bound the model-qData

Confused and stuck

Any help will be appreciated.

Thanks,

Ashly

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
0 Kudos

No need to create 1 more model. Bind with other property with same model and oTable.getModel() will gives you all the data entered in table.

So retrieve those values from your table and pass to backend with backend Properties.

Like below,

BackendModel.Property1=oTable.getModel().getData().Remarks;

Former Member
0 Kudos

Hi Santhosh,

Thanks for your reply

In the back end, it has to be stored as 15 rows as question-rating-remarks. So I should traverse the table by getting its length right, to access each row?

As of now I have binded the RATING & REMARKS text fields to 'rating' & 'remarks' in the dataset.

So can you please tell how can I access each row.

==>> This is how I have added columns:

var oColumn1 = new sap.ui.table.Column("Rating",

  {

  label: new sap.ui.commons.Label(

     {

       text: "Rating",

       design:sap.ui.commons.LabelDesign.Bold

     }),

  template: new sap.ui.commons.TextField(

     { id: 'Rate',value: '{rating}',

          editable:true

     })

  });


  var oColumn2 = new sap.ui.table.Column("Remarks",

  {

  label: new sap.ui.commons.Label({

  text: "Remarks",

  design:sap.ui.commons.LabelDesign.Bold}),

  //template: new sap.ui.commons.TextView().bindProperty("text","remarks")

  template: new sap.ui.commons.TextField({ id:'Remark',value: '{remarks}',editable:true })

  }  );

  oTable.addColumn(oColumn);

  oTable.addColumn(oColumn1);

  oTable.addColumn(oColumn2);

  oTable.setModel(oModel);

  oTable.bindRows("/modelData");

  oTable.placeAt("Panel2");


Thanks,

Ashly

santhu_gowdaz
Active Contributor
0 Kudos

Ashly,

     In table 15 rows are there so it will create the 15 rows in backend. What is the issue?

If you want to access table data check out these examples,

For more Examples check out my Blog-

Answers (0)