Skip to Content
author's profile photo Former Member
Former Member

Custom Delete Button without oData

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

}

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jun 28, 2016 at 11:58 AM

    what if you added it to a custom data attribute ?

    check out the documentation

    SAPUI5 SDK - Demo Kit

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.