Let's follow up this discussion at the Neptune Community

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

sap.m.table add row

Hello forum,

How I could add a new editable row to sap.m.table?



Best Answer

Hi Salvatore


Yes this is offline coding, but will be faster and better optimized. No need to send a request to SAP if is easy to achieve the same with offline coding. 


Offline first Approach...




Regards

Ole Andre 


Hi Salvatore


Instead of text elements as child to the ColumnListItem you need to use input fields. Then you can edit the table content. Sending the data back, example on save button, you need to also click the send checkbox and send the entire table back to SAP. It will then be available in your Application Class with the changed data.


PS: you can also use the wizard on the table after binding it, right click -> wizard-> Insert Fields - Edit



Regards

Ole Andre 


2 people like this

Hi Ole-André,

sorry but apparently my question was not so clear.

Having a look to the attached image, I want to add an empty editable row in a table displayed. Not all fields are input fields (because are calculated in SAP).  How can I do it?

Thanks

JPG
(54.4 KB)

Hi Salvatore


There is two option i can recommend:


1) Dialog/Page option. 

Create a popup dialog or another page, and bind it to the structure of your internal table and show the fields you will edit. When pressing a save button, use the ModelData.Update(nameoftable,keyfield,keyfieldValue,newData); and navigate back or close dialog. The table is then updated. You can also add the event for the item detailPress and do the same and update the content.


newData = the model object of the dialog/page.


2) Table editing

Pressing the Add button you need to add a new entry in the model to the table. Use ModelData.Add(nameoftable,newData);


newData = just create en empty record like this newData = {};


More info:

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


Regards

Ole Andre 

Thank you Ole-André, 

I will try today and I'll be back to you with a response.

Anyway both cases are related to offline application, isn't it? In my case there is no offline. Anyway I will try.

Salvatore.

Hello Ole Andre,

I guess both solutions are for offline application. Mine is only online. Anyway I'll try

Thanks.

Salvatore.

Answer

Hi Salvatore


Yes this is offline coding, but will be faster and better optimized. No need to send a request to SAP if is easy to achieve the same with offline coding. 


Offline first Approach...




Regards

Ole Andre 

Login or Signup to post a comment