cancel
Showing results for 
Search instead for 
Did you mean: 

Add an empty to Smart Table - Tabletype-Grid Table

raagapriya_s
Discoverer
0 Kudos

Hello Team,

I have one requirement in our project where I need to add an empty row for the Smart Table table type - Grid Table, on click of add button. I have explored few of the blogs but couldn't find relevant suggestions. I also tried to use standard method addRow for the grid table, but I am getting error - "The control manages the rows aggregation. The method "addRow" cannot be used programmatically!". But we want to provide a justification to client that why this standard method can't be used.

Accepted Solutions (0)

Answers (2)

Answers (2)

maheshpalavalli
Active Contributor

Hi RAAGA PRIYA S,

OData v2 model doesn't support the table binding update if you want to insert the data locally without sending the request to the backend. Smartable is tightly integrated with OData model. Infact Odata v4 model also doesn't support it completely.

If you want to create an entry, then you need to show a popup let the user enter the data and on click of save in the popup then you need to submit the changes to the backend. Then the smart table will be updated with the new entry. BTW you cannot mix json model and smart table together.

Else, simply use a normal table with json binding and add a new record to the json model data which wil automatically show the new record in the table and you can perform changes there.

https://blogs.sap.com/2016/10/11/addremove-rows-sap.m.table-quick-reference/

BR,

Mahesh

Abdul_Waheed
Contributor

Hello Raaga,

Add an empty record to the JSON model bound to the table.

raagapriya_s
Discoverer

Hi Abdul,

I have bound the smart Table using OData model. Application is of Master-Detail type,smart table gets the data based on the list selected from the Master page. Hence I have used OData Model. Any methods to add an empty row, when the table is in edit mode?