Quantcast
Channel: SCN : All Content - SAP HANA Cloud Platform Developer Center
Viewing all articles
Browse latest Browse all 3285

How to get the values of selected rows from a table by checking the checkbox?

$
0
0

Hi all,

 

I have a table whose rows get added on click of a button.The values for these rows comes as array of objects.

I also have checkboxes in the table. Now when I select the checkbox, only those rows whose checkbox has been selected has to be posted

to the server.

Here I have attached the code what I tried:

 

[this is for adding values to the table]

 

 

v01=sap.ui.getCore().byId("l02").getValue();

v1=sap.ui.getCore().byId("l2").getValue();

  v2=sap.ui.getCore().byId("l4").getValue();

   v3=sap.ui.getCore().byId("l6").getValue();

v4=sap.ui.getCore().byId("l8").getValue();

  v5=sap.ui.getCore().byId("l10").getValue();           

 

  v6=sap.ui.getCore().byId("l12").getValue();            

  v7=sap.ui.getCore().byId("l14").getValue();

  v8=sap.ui.getCore().byId("l16").getValue();

 

var object1={odno:"",itmno:v01,matdes:v1,quantity:v2,uom:v3,plnt:v4,sloc:v5,sttype:v6,coscen:v7,rmvt:"",txt:v8};          

  arr1.push(object1);             

    arr2={"arr2" : arr1}              

   oTable.setModel(new sap.ui.model.json.JSONModel(arr2)); 

 

 

 

[this is for the XML payload]

 

postfunc:function()

    {

 

em3=sap.ui.getCore().byId("cb1").getSelected(true);

  

     var lu_design= t1+"T00:00:00";

     var lu_loc=t2+"T00:00:00";

     var u_extn=t3;

 

 

  for(var i=0;i<arr1.length;i++){

      var obj = {"OrderNumber":arr1[i].odno,"ItemNumber":arr1[i].itmno,"Material":arr1[i].matdes,"Qty":arr1[i].quantity,"UOM":arr1[i].uom,"Plant":arr1[i].plnt,"SLoc":arr1[i].sloc,"StockType":arr1[i].sttype,"CostCenter":arr1[i].coscen,"ReasonforMvt":arr1[i].rmvt,"Text":arr1[i].txt};

    

      arr3.push(obj);

      }

   

  alert("arr3:"+arr3);

   

 

 

  var upddata = {

      OrderNumber:"",

      PostingDate: lu_loc,

      DocDate: lu_design,

      HeaderText:u_extn,

    

      ToGIItems: arr3,

    

     };  

}

 

 

I have attached the screenshot of my table.

can someone help me with this?

 

 

Regards,

Ramya


Viewing all articles
Browse latest Browse all 3285

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>