Skip to Content

getting the CustomData of the view from the fragment....

Hi guys, I need your help...

I have a button edit from each line of the table, when I click I get the ID and STATUS from CustomData on the xml... when status "1" I just delete the line, when "2" I have to open a fragment where I have to check the status again... how I get the STATUS and ID from that line, not all id's and status, just only what I have clicked on, again from the fragment???

my xml :

<Button id="btnEdit" icon="sap-icon://edit" visible="true " press="_onEditGeneration">
           <core:CustomData value="{gia_es_odata>ID}" />
           <core:CustomData  value="{gia_es_odata>STATUS_ENTREGA}" />

on edit it will check ...

_onEditGeneration: function(evt) {
       let lineID = evt.getSource().getCustomData()[0].getValue();
       let lineSTATUS = evt.getSource().getCustomData()[1].getValue();

        if (lineSTATUS == 2) {
           if (!this._oEditDialog) {
              this._oEditDialog = sap.ui.xmlfragment(this.getView().getId(),
           // Abre o dialogo

        if (lineSTATUS == 1) { 
       } ,

dialog if "2"

_onSaveEditGeneration: function (){

how can I get the same id and status now???

Thanks and sry for my English.

Add comment
10|10000 characters needed characters exceeded

  • Hi Carlos Henrique de Toledo,

    Can you provide the whole xml code where the button is placed.. or atleast the the code where the button is placed..?(table code)

    (Because it looks like you don't need custom data to handle this scenario, you can bind model and get the bound context to read the data.)



  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 25 at 12:55 PM

    Hi Carlos,

    i would set a JSONModel to your template so that you can access the data from your template as well.

    Do something like:

    _onEditGeneration: function(evt) {
      var oCustomData = evt.getSource().getCustomData();
      this._oEditDialog.setModel(new sap.ui.model.json.JSONModel(customData), "customData");

    Than you are able to do:

    _onSaveEditGeneration: function (){
      var oCustomData = this._oEditDialog.getModel("customData");

    Hope that helps!


    Add comment
    10|10000 characters needed characters exceeded