Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

onBefore/AfterRendering in combobox.

$
0
0

Hi,

 

I have one table which is tied to one ODataModel. Now in the table one of the columns is 'ComboBox' which is tied to one of the properties in the model.

Depending upon some other property I am supposed to make this combobox editable.

For that I tried using 'formatter' function and 'onBefore/AfterRendering' call back as follows. None of them worked. It was strange to know that 'onBeforeRendering'/'onAfterRendering' doesn't get called.

 

Find my code below:

 

var combo = new sap.ui.commons.ComboBox({

  editable: false,

   valueState:{

  parts:["/StatusText","/EndDate"],

  formatter: function(oVal1, oVal2){

  console.log('calling formatter');

  console.log("oVal1"+oVal1); // this is undefined

  console.log("oVal2"+oVal2);// this is also undefined

  if(oVal2){

  this.setEditable(true);

  }

  return sap.ui.core.ValueState.None;

 

  }

  },

  onAfterRendering: function(arg1, arg2){

  console.log('onBeforeRendering:: function()');

  console.log(arg1);

  console.log(arg2);

  },

  items: [

                                  new sap.ui.core.ListItem({text: "New",key:"0"}),

                                  new sap.ui.core.ListItem({text: "In Process",key:"1"}),

                                  new sap.ui.core.ListItem({text: "Complete",key:"2"}),

                                  new sap.ui.core.ListItem({text: "On hold",key:"3"}),

                                  new sap.ui.core.ListItem({text: "Cancelled",key:"4"}),

                                  new sap.ui.core.ListItem({text: "Rejected",key:"5"}),

                                  new sap.ui.core.ListItem({text: "In review",key:"6"}),

                                  new sap.ui.core.ListItem({text: "Approved",key:"7"}),

                                  new sap.ui.core.ListItem({text: "Approved by SD",key:"8"}),

                                  new sap.ui.core.ListItem({text: "Rejected by SD",key:"9"})

                                  ]}).bindProperty("value","StatusText").bindProperty("selectedKey","Status")

                                  .attachChange({name :sProperty},this.change);

  column.setTemplate(combo);

 

 

 

Any Help will be appreciated.

 

Thanks,

Supriya Kale


Viewing all articles
Browse latest Browse all 6178

Trending Articles



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