on 10-18-2016 9:57 PM
Hi Experts,
I am using sap.ui.table.table control in my application.
I have an requirement to disable rows depending upon some flag lets say XRow.
I know we can't disable a row but we can set the editable property for controls in column as false/true using the formatter with XRow.
But my issue I also has individual flags for these columns. So I don't know how to apply two formatters for a single column (One with XRow and another with individual flag)
Could you please help.
Thanks
Sanjay
Hello,
I think you can pass multiple values in a parts, try this,
Binding in XML:
<Input editable="{parts:['XRow', 'indivedual flag'], formatter: '.setRowEditable'}" />
JS:
setRowEditable: function(bRowFlag, bIndividualFlag) {
var bEditable = false;
if (!bRowFlag) {
bEditable = false;// i think, if XRow is false then individual flag should not be considered
} else {
bEditable = bIndividualFlag;
}
return bEditable;
}
Hope this what you looking for.
Regards,
Akhilesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
USE THIS CODE:
//Define some sample data
var aData = [
{ flag :"YES", rating: 3},
{ flag :"NO", rating: 3}
];
//Create an instance of the table control
var oTable = new sap.ui.table.Table({
title: "Table Example",
selectionMode: sap.ui.table.SelectionMode.Single
});
oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Checked"}),
template: new sap.ui.commons.CheckBox().bindProperty("checked","flag",function(data){
this.false = false;
if(data === "YES"){
this.setProperty("editable",this.false);
return !this.false;
}
})
}));
//Create a model and bind the table rows to this model
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData({modelData: aData});
oTable.setModel(oModel);
oTable.bindRows("/modelData");
//Bring the table onto the UI
oTable.placeAt("content");
,
Hi Sanjay- I hope this code will helpful to you. Please find below link.
https://fiddle.jshell.net/KarthikArjun/xaptfysL/1/
oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Checked"}),
template: new sap.ui.commons.CheckBox().bindProperty("checked","flag",function(data){
this.false = false;
if(data === "YES"){
this.setProperty("editable",this.false);
return !this.false;
}
})
}));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.