on 10-23-2017 10:33 AM
is it possible to edit the text in table for the fileld like
<Text text="{company}"/>
Hi Priya,
You can use <Input> control. Set its property editable="true" to allow editing and false to display normal text.
<Input type="Text" editable="true"></Input>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Priya,
Either you can Disable or set Editable to false. As given below. If you want to Text field then use two fields in a table cell and play hide/visible with both by binding same property to them. You can do this in Change event of input field. As given below.
<Input type="Text" editable="true" change="myFunction"></Input>
myFunction : function(oEvent){
oEvent.getSource().setEditable(false);
oEvent.getSource().setEnabled(false);
}
Hi Priya,
You should use Input control for text editing. It has a property to make it non editable as well. - property name: editable and possible values are true or false.
You can learn more about input control at below given link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Priya,
Either you can Disable or set Editable to false. As given below. If you want to Text field then use two fields in a table cell and play hide/visible with both by binding same property to them. You can do this in Change event of input field. As given below.
<Input type="Text" editable="true" change="myFunction"></Input>
myFunction : function(oEvent){
oEvent.getSource().setEditable(false);
oEvent.getSource().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 Irfan ,
what exactly i need is,before clicking on that row it should like on below image
after clicking that row ,it should be like below image
on above image it changes from text field to input field and after saved it again looks as text field.This scenario,Is it possible to do with sap.m.table??
Thanks in advance
Hi Priya,
Inside table cell put something like first sell with HorizontalLayout.
<ColumnListItem vAlign="Middle">
<cells>
<l:HorizontalLayout>
<Text text="{GTMdl>Class}" visible="{GTMdl>DisFldVis}"/>
<Input type="Text" visible="{GTMdl>CrtFldVis}"></Input>
</l:HorizontalLayout>
<Text text="{GTMdl>Class}" />
<Text text="{GTMdl>Age}" />
<Text text="{GTMdl>Version}" />
</cells>
</ColumnListItem>
And your model data goes like this
var oNVData = [{
//Other Fields
CrtFldVis : false, //flag for visibility of Create Fields
DisFldVis : true //flag for visibility of Display Fields
},{
//Other Fields
CrtFldVis : false,
DisFldVis : true
},{
//Other Fields
CrtFldVis : false,
DisFldVis : true
}];
var oJson = new sap.ui.model.json.JSONModel({"GTData":oNVData});
this.getView().setModel(oJson, "GTMdl");
Controller code on click of your text :
VisCrtFld : function(oEvent) {
//this.getModel("GTMdl")
// debugger;
var sPath = oEvent.getSource().getBindingContext("GTMdl").getPath();
this.getView().getModel("GTMdl").setProperty(sPath+"/CrtFldVis", true);
this.getView().getModel("GTMdl").setProperty(sPath+"/DisFldVis", false);
}
Tested and Working.
If you have any doubts please ping me on my linkedIn
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
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.