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

SAPUI5 Table Column With Different Controls using Factory Function

$
0
0

Hi Experts,

 

I have created one Table in which one column have different control. I have used factory function for this but after rendering it is always showing last control which I have returned in each row.

 

var oEntPropertyDetail = new sap.ui.table.Table({

  width : "auto",

  selectionMode: sap.ui.table.SelectionMode.None,

  visibleRowCount: 10,

  visible: true,

  enableColumnReordering: false,

  fixedColumnCount: 1,

  editable: true,

  columnHeaderVisible: true,

  columns: [

          new  sap.ui.table.Column({

           label: new sap.ui.commons.Label({

           text:"Properties"

           }),

           width: "150px",

           template: new sap.ui.commons.TextView({

           text: "{entPropDetailProp>name}",

           design: sap.ui.commons.TextViewDesign.H6

           })

           }), 

           new  sap.ui.table.Column({

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

           width: "100px",

           }).bindAggregation("template","entPropDetailProp>/properties",function(sID,oContext){

           var vEntPropSelIndex = oController.getView().getModel("entPropSelectedIndex").getData().index;

           if(vEntPropSelIndex != -1){

           var value = oContext.getProperty("type");

           switch(value) {

           case "TXTALIGN":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/text_align/value}"

           });

           case "SHLBL":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/short_label/value}"

           });

           case "TRTYPE":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/translationtype/value}"

           });

           case "IDSER":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/id_series/value}"

           });

           case "TYPE":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/type/value}"

           });

           case "TRID":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/transport_id/value}"

           });

           break;

           case "DESC":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/description/value}"

           });

           break;

           case "LEN":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/length/value}"

           });

           break;

           case "ISMANDATORY":

           return new sap.ui.commons.CheckBox({

           checked:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/ismandatory/value}"

           });

           case "DEFVAL":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/defaultvalue/value}"

           });

           case "ISPRIM":

           return new sap.ui.commons.CheckBox({

           checked:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/isprimarykey/value}"

           });

           case "CLASS":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/classes/value}"

           });

           case "SHCAP":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/short_caption/value}"

           });

           break;

           case "PREC":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/precision/value}"

           });

           case "BOTAB":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/botable/value}"

           });

           case "LONGLAB":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/long_label/value}"

           });

           case "PLH":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/placeholder/value}"

           });

           case "DEFLBL":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/default_label/value}"

           });

           case "DBELE":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/dbelement/value}"

           });

           case "FORMAT":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/format/value}"

           });

           case "ENTPID":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/entitypropertyid/value}"

           });

           case "PROPTYP":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/property_type/value}"

           });

           case "PATT":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/pattern/value}"

           });

           case "ISTRANS":

           return new sap.ui.commons.CheckBox({

           checked:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/istransientfield/value}"

           });

           case "VALCONT":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/value_control/value}"

           });

           case "DATATYPE":

           return new sap.ui.commons.TextField({

           value:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/datatype/value}"

           });

           case "ISSYSFLD":

           return new sap.ui.commons.CheckBox({

           checked:"{copyEntPropData>/d/properties/results/"+ vEntPropSelIndex +"/issystemfield/value}"

           });

           }

           }else{

           return new sap.ui.commons.TextView({

           value: "No Data"

           });

           }

           })

           ]

  });

 

  oEntPropertyDetail.bindRows("entPropDetailProp>/properties");

 

It is showing checkbox in each row.

 

Please guide me to solve this issue.

 

Thanks and Regards,

Amit


Viewing all articles
Browse latest Browse all 6178

Trending Articles