Skip to Content
0
Former Member
Jun 28, 2016 at 11:48 AM

Custom Delete Button without oData

58 Views

Hi,

we are retreiving Data from our Node.JS Application via AJAX-Calls. We are not using oData because it doesn't fit all our needs. Now we encounter a problem:

In order to delete an Item, we've implemented a Button. On Press it should return an ID, to fire a DELETE call to our API with that ID. I didn't found a solution yet, to hand over an ID from DB into our View, to read that our within the controller.

I already tried to bind that DB-ID to the XML-id-Tag

<Button id="removeTelefon_{modelTelefon>TelefonID}" icon="sap-icon://delete" press="onDeletePhonenumber"/>

but it seems, that those operations are not supported by SAP. So I tried to bind the ID to a hidden Text-Field, because I could receive the clicken Element-Position via oEvent.getSource().getId() (its an incremental Number, i could read out):

<core:InvisibleText id="invisibleText" text="removeTelefon_{modelTelefon>TelefonID}"/>


But nope, no way to get the Invisible Text at the same position as the Button.



TL;DR:

I just want to bind a DB-ID, to a Button, in order to delete an Item via AJAX-Calls for our Node.JS-Backend-Service. oEvent.getSource().getBindingContext().getPath(); wont work, because we aren't using oData.



jQuery-Style:

$('.deleteTelefon').click(function() {

var id=this.attr('id'); // wont get this with SAPUI5 😔

// fire ajax call with ID

}