cancel
Showing results for 
Search instead for 
Did you mean: 

How can I to add manually a row without binding?

miguelangel_daz
Explorer
0 Kudos

Hi, I'm trying to add a row manually to a sap.m.table without success

I have been seeing it is posible in sap.ui but not in sap.m:

var row = new sap.ui.table.Row("row1",{

                     label : new sap.ui.commons.Label("l1",{

                                  text: "Row1"

                           })

              });

                     oTable.addRow(row);

I have to verify if in my json rest field date is empty, then I have to put an input date, else then I have to put a label text.

How can I to do this requirement with sap.m.table?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member195440
Participant
0 Kudos

Hi Miguel,

Sure this is possible. What you need to do is use the method "addItem" of the sap.m.Table. Pass in any sap.m.ListItemBase control as a parameter.

See here for the API - OpenUI5 SDK - Demo Kit

And here is the API for sap.m.ListItemBase (choose an appropriate subclass) - OpenUI5 SDK - Demo Kit

Hope this helps!

Oli

miguelangel_daz
Explorer
0 Kudos

Thank you Oliver

Could you give me an example please?

Thanks a lot

former_member195440
Participant
0 Kudos

Sure, have a look at this JS Bin - JS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type=&q...

Note that it is not assembled with best practice, needs a proper MVC structure but it will show you the basics of putting a row in the table.

The XML is shamelessly copied from the samples and cut down - OpenUI5 Explored

Hope this helps,

Oli

miguelangel_daz
Explorer
0 Kudos

Thank you Oliver! your JSBin is so helpful!

Answers (0)