on 10-07-2016 12:26 PM
Hello Folks,
I created a fragment which holds some control( table and a button in my case ). I created separate controller for Fragment.
I added the fragment to the view dynamically in onInit of the view controller.
onInit : function(){
var f = new oFrg();
var fc = sap.ui.xmlfragment(this.createId("f1"), "testfrg.view.test", f);
this.getView().byId("page1").addContent(fc);
}
Now i have everything in View.
on click of button i want to do some operation to table so to get the table from fragment i have to pass id like below:
var t = sap.ui.getCore().byId("__xmlview0--f1--Table"); // f1 is fragment id and Table is table id
__xmlview0-- is getting concatenated since the event handler is in fragment own controller.
If the same event handler will be in view controller we can access table by only giving fragment id and the table id using sap.ui.core.Fragment.createId(sFragmentId, sId)
Now if i provide the id to my xmlview (lets say View1 ) then the same controller id will be concatenated with
__component0--View1--f1--Table
My question is how to get rid of __component0--View1 ?
or what is the way to get the controle of fragment into its controller.
Thanks for your input.
Abhi
var fc = sap.ui.xmlfragment("myFrag", "testfrg.view.test", f);
myControl = sap.ui.core.Fragment.byId("myFrag", "myControlid")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jun,
Nice to see you again .
myControl = sap.ui.core.Fragment.byId("myFrag", "myControlid")
this will not give the control reference as this method will just concatenate myFrag--myControlid and try to get Id from core.
in my case control id is getting concatednated as
__xmlview0--fragmentid--controlId. ( if view id is not given)
__component0--viewid--fragmentid--controlId. ( if view id is given as viewid ).
I debugged the method
Thanks,
Abhi
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.