Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)

Questions aubout Table functions

Hi,

i have some questions about tables:


1. How can i with the checkbox "selection" take all rows checked ( first column in the picture) ?


The change code:


if ( selection.getChecked(true)){

Au.setChecked(true);    //this are the Checkboxes in the first row

}


Outside the table it works, but when i want an access with a checkbox to the table it doesen't work.


2. Same principle, the access outside to the table. In the 3. column, i have to scan a barcode and set the field with the number when the row is checked (checkbox).

When i do it in a page before and load in a secound page the table with button click it runs and all textfields were filled

In the same page if i scan, it doesen't appear in the fields?


Another ting is, how can I implement it, when i select the first row, it means the first row? Can i set somewhere a row id? I think when i scan in the same page, it fills all Textfields and not the checked row?


3. The three checkboxes in one row ( i.o./n.i.o./n.n. see to picture)

 Only one can be selected:eg.:   i.o.(false) n.i.o.(true) n.n.(false)


I have the code like this in all change events of the checkboxes but it doesen't run? Outside the table it does work.


if (oIO.getChecked(true)){

   oNIO.setChecked(false);

   oNN.setChecked(false);

}



I hope you understand my problems and can help me.


Thanks & Regards,


Michael


Great! Thank you so much.

Hi Salvatore


Using special characters like & in the AJAX_VALUE will not work. It's being passed to the SAP within an URL, and & is a separator for new parameters in the URL. In this case we recommend you using the additional send/receive button and mark the model you would like to send to SAP.


If you need to pass it in the URL you can add a small javascript to encode the data 


   

getOnlineoImage(encodeURIComponent(value));


 

 

Then you also need to decode the AJAX_VALUE in your application class.  


ajax_value = cl_http_utility=>unescape_url( ajax_value ).


Regards

Ole Andre 


1 person likes this

Hi Salvatore


You have two options:


1) Concatenate two values into the ajax_value an split them in the application class.

2) Use the additional send/receive button to the object and set what Model Source to be sent back to SAP. This is the most flexible and best solution.



Regards

Ole Andre 

Hi Ole Andre,

I have to manage 2 values in the getOnline.... how I can do this?

Hi Ole Andre,


now it works! Thank you very much!


Regards

Michael

Hi Michael


You need to change to getProperty to FieldName from SAP rather than UI5 object.


Example with the fieldName KUNNR:

  

var context = oEvent.oSource.getBindingContext();
var value = context.getProperty("KUNNR");    
getOnlineoImage(value);
 

  

Regards

Ole Andre  

HI Ole Andre,


i tried it with the SAPUI5-> List/Table->Get selected Row code.



var context = oEvent.oSource.getBindingContext();

var value = context.getProperty("txtoTableBild");   // this is the fieldname (ID)

getOnlineoImage(value); 


When i do this the variable value is empty and so the ajax_value is empty too in the abap programm. Do you know why it goes wrong?


Or can you please explain me how to do the second way?


Regards

Michael


Hi Wilhelm


In the javascript editor, you can right click and get a lot of javascript premade functions. What you need is the one from SAPUI5->List/Table->Get Selected Row. It will provide you with how to access model data for the current row. 


   

var context = oEvent.oSource.getBindingContext();
var value = context.getProperty("yourField");
getOnlineoImage(value); 

 

Another way is to link the image in the model or putting the base64 encoded image data into the model.


Regards

Ole Andre  

Hi Ole Andre,


ty for your help.


I have a last question about tables.


In the first column there is a source code for a image. How can i get this text into a variable when I click on the button in the next column?

my code looks like this :

var i;

i = bild.gettext();

getOnlineoImage(i);

The problem is, the variable i is empty.


Regards

Michael

Hi Michael


My recommendation is working with the ModelData instead of the objects. You can bind the SELECTED/CHECKED property to a field in the Model. And use our ModelData to Update/Delete data. Then due to databinding it will update the correct components.


More info on ModelData

https://template.neptune-software.com/neptune/sdk/explored#doc00163EDC99661ED4B4C34B6CE4E56F06


Tip: Defining the table you bind to the sapui5 table object, you can use the Component Type DDBOOL_D in SE11. Will automatically convert from space/x to false/true.


Regards

Ole Andre 

Login or Signup to post a comment