Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8594

Re: how can I insertRow which has button with press event?

$
0
0

hi Robin,

Now I add row below:

 

this.deleteButton = new sap.ui.commons.Button({

  text:"delete",

  press: function(oControlEvent){

  var currentcontent = oControlEvent.getSource().getParent().getBindingContext();

  this.fireEvent("action",{actionCommand:"delete",mParameters:currentcontent.getObject()});

  }

  });

this.deleteButton.attachEvent("action",this.handleEvent,this);

 

this.oTable = new sap.ui.table.Table({

        minAutoRowCount:5,

        visibleRowCountMode:sap.ui.table.VisibleRowCountMode.Auto,

        id:"oTable",

        columns:[

      new sap.ui.table.Column({

        label:new sap.ui.commons.Label({text:"Endpoint URL"}),

        template: new sap.ui.commons.TextField({id:"hello"}).bindProperty("value","name"),}),

     new sap.ui.table.Column({

        label:new sap.ui.commons.Label({text:"Protocol"}),

        template: new sap.ui.commons.ComboBox({items:[

     new   sap.ui.core.ListItem({text:"SOAP_OVER_HTTP_HTTPS"})]}).bindProperty("value","Protocol")}),

     new sap.ui.table.Column({

        label:new sap.ui.commons.Label({text:"Namespace"}),

           template: new sap.ui.commons.TextField({id:"hello2"}).bindProperty("value","name")}),

     new sap.ui.table.Column({

        label:new sap.ui.commons.Label({text:"Authentication"}),

           template: new sap.ui.commons.Link().bindProperty("text","linkText").bindProperty("href","href")}),

     new sap.ui.table.Column({

        label:new sap.ui.commons.Label({text:""}),

        template: this.deleteButton})]

        });

 

this.oData=[

      {name:"",checked:true,Protocol:"SOAP_OVER_HTTP_HTTPS",linkText:"Edit Authetication",href:"",text:"-"}];


this.oModel = new sap.ui.model.json.JSONModel();

        this.oModel.setData({modelData:this.aData});

        this.oTable.setModel(this.oModel);

        this.oTable.bindRows("/modelData");

 

When initialization, press the button, oControlEvent.getSource().getParent().getBindingContext() has object. But if I add button dynamically like below, when pressing there is no object:

 

addRow: function(){

    var config = {name:"",checked:true,Protocol:"SOAP_OVER_HTTP_HTTPS",linkText:"Edit Authetication"+this.aData.length,href:"",text:"-"};   

        this.aData.push(config);

        this.oModel.setData({modelData:this.aData});

        this.oTable.setModel(this.oModel);

        this.oTable.bindRows("/modelData");

        /*this.oTable.insertRow(new sap.ui.core.Row("rowadd",new sap.ui.commons.Label({text:"rowadd"})),oTable.getVisibleRowCount());*/

    },


Viewing all articles
Browse latest Browse all 8594

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>