on 03-15-2016 8:18 AM
Hello,
I've tried to fire the press event (or something else ) of a CustomListItem.
<List growing="true" growingScrollToLoad="true" includeItemInSelection="true" items="{path: '/EmployeeSet'}">
<items id="employeeMasterListItems">
<CustomListItem id="employeeMasterListItem" type="Active" press="onSelect">
<Label text="Test" />
</CustomListItem>
</items>
</List>
In the controller I have the following method:
onSelect: function(oEvent) {
console.log("onSelec", oEvent);
}
With Type DetailAndActive
I can fire the detailPress
event, but nothing else.
Any idea? Thanks.
I solved this problem by adding sap.m
to the data-sap-ui-libs
inside my index.html
.
It seems to be that the events of sap.m controls are not properly fired if the library is not preloaded.
<script src="resources/sap-ui-cachebuster/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons, sap.m"
data-sap-ui-appCacheBuster=" ...and so on... >"
</script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Have you tried putting a link in your customListItem that will allow you to use the press functionality
<Link text="{Name}" press="handlePress"/>
Also you need to set your controller value in your fragments if they have controls inside them too.
regards
Chantele
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
add one line of code in your xml view
controllerName="<your controller name>"
JS Bin - Collaborative JavaScript Debugging
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello!
1) Did you define a controller in the view header?
2) Is there any errors in the developer console of the browser?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The view exists of two fragments.
Main View
<core:View controllerName="view.Employee" xmlns:core="sap.ui.core" xmlns="sap.m"
xmlns:html="http://www.w3.org/1999/xhtml">
<SplitApp id="idSplitAppEmployee">
<detailPages>
<core:Fragment fragmentName="view.fragment.EmployeeDetail"
type="XML" />
</detailPages>
<masterPages>
<core:Fragment fragmentName="view.fragment.EmployeeMaster"
type="XML" />
</masterPages>
</SplitApp>
</core:View>
Fragment with customListItem
<core:FragmentDefinition xmlns:core="sap.ui.core"
xmlns:footerbar="sap.ushell.ui.footerbar" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" xmlns:l="sap.ui.layout"
xmlns:custom="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1">
<Page id="employeeMasterPage" backgroundDesign="Solid"
If I use Type="DetailAndActive" and detailPress="onSelect" I'm able to trigger right method. But I need to use Type="Active". Therefore I tried to fire press="onSelect".
Do I have to add a controller to the fragment for using these methods?
Unfortunateley, there is no error or something else in the developer console of the browser.
The methods are even registered on the object.
User | Count |
---|---|
74 | |
9 | |
7 | |
6 | |
6 | |
6 | |
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.