cancel
Showing results for 
Search instead for 
Did you mean: 

Delete a row from table

jansch
Participant
0 Kudos

Hi @all

I'm really new to SAP HANA and SAPUI5 and I'm trying to do some first projects. Currently got a person list working. (See tutorial: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40371b91-7e95-3110-e29a-cde3b1447...) Now I want to add some features to that application without any tutorial but I'm actually not really moving forward...

What I want: Select ONE row and delete it after confirmation.

How do I start with this when I have no idea how to do it? I googled a little bit but didn't find anything useful.

What I tried so far: I added a function in the controller named "removePerson". But how do I state a delete action?

I am pretty good with SQL, is there an option to just do this with SQL, so that I can just call an SQL-Script?

And how do I start a dialog / action when I select a row?

I have already read a little bit into the dialog function, so I know how to fill a dialog with content and how to show it.

Anyone willign to help me with this beginner problems?

Attached you can find a couple screenshots of whats actually there...

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
0 Kudos

Answers (1)

Answers (1)

venkatachala_ck
Active Participant
0 Kudos

new sap.ui.commons.Button("deletebuttonId", {

                              icon : "sap-icon://delete",

                              style: sap.ui.commons.ButtonStyle.Reject,

                              lite : true,

                              tooltip:"Delete",

                              press : function(){

                              var idx = oTable.getSelectedIndex(); //oTable is ur table name

                                 if (idx !== -1) {

                                 var m = oTable.getModel();

                                 var data = m.getData();

                                 var removed = data.splice(idx, 1);

                                 m.setData(data);

                                 m.refresh();

                                 }

                              }

                               }),

give your table name in place of oTable .