on 05-22-2017 8:06 AM
Hi All,
I want to disable the update button in the CustomListItem while press the Upload Button in the view. I tried the disable option but it works only for the first array. Pls suggest some idea.
Attached Image and tried code.
Code View:
<Button id ="attach" text="Upload" type="Emphasized" press="onAttachUpload" > </Button>
Controller:
onAttachUpload:function(){
this.getView().byId("updatedis").setEnabled(false);
},
ah..i took it another way i guess, basically approach should be :
// update button
<Button enabled="{viewModel>/bEnableUpdate}"></Button>
//Code in controller
onInit: function() {
var viewProperties = {
bEnableUpdate: true
};
var viewModel = new sap.ui.model.json.JSONModel(viewProperties);
this.getView().setModel(viewModel, "viewModel");
},
onAttachUpload: function() {
this.getView().getModel("viewModel").setProperty("/bEnableUpdate", false);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply. I have tried your code. Initially all the buttons are visible.But when I try to disable all the buttons next time,
only the first button is getting disabled.
Can u help me with this..?
try this should work:
onAttachUpload: function(oEvent){
var oButton = oEvent.getSource();
oButton.setEnabled(false);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You need to use model for this as you cannot directly get control using the Id of the control and apply setEnabled false. As the Id is not same for all the buttons in the custom list item.
Code in view :
// update button
<Button enable="{emodel>evalue}" > </Button>
Code in controller
onInit :function()
{
var enable = {evalue:true};
var emodel = new sap.ui.model.json.JSONModel();
emodel.setData(enable);
this.getView().byId("<tableId>").setModel(emodel,"emodel");
this.getView().byId("<tableId>").bindElement("emodel>/");
}
onAttachUpload:function(){
var enable = this.getView().byId("<tableId>").getBindingContext("emodel").getProperty();
enable.evalue = false;
var emodel = new sap.ui.model.json.JSONModel();
emodel.setData(enable);
this.getView().byId("<tableId>").setModel(emodel,"emodel");
this.getView().byId("<tableId>").bindElement("emodel>/");
}
this will disable all the update buttons
thanks
Viplove
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
<tableId> is your table's id you need to place here id of your table don't just directly copy paste the code bro , did you mention any id to your table if not than mention it and than use it ... undefined of getBindingContext means you don't of any control in your view of the mentioned id .
thanks
Viplove
hi,
Please view below page for solution
Modify UI Control Properties via mAggregation
Thank you !
Silent Monk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.