0

I have a List with StandardListItem with an icon (the one from THIS example). The StandardListItems got a press event to handle a function now:

<List id="test-list" items="{
    path   : '/products', 
    sorter : [{
        path       : 'prodName', 
        descending : true
    }]
}">
    <items>
        <StandardListItem title="{prodName}" 
                          description="{prodCountry}" 
                          press="onListPress" 
                          type="Active"
                          icon="{
                            path:'price', 
                            formatter:'.getIconFlag'
                            }" 
        />
    </items>    
</List>

Now I'd like to have a simple Tooltip displayed (showing e.g. the prodName) when clicking on the Icon (and then positioning the tooltip relative to the icon although it is not a seperate control). Problem: The press event is fired for the whole StandardListItem including the icon. I did not find out if this is possible, but based on the markup I think is has to be, because the icon is a seperate DOM element. enter image description here ´.getIcon()´ just returns the String URI for the icon property, so .. Is it possible to handle a seperate press/click event for the icon "section"?

[EDIT:] I solved it: What I wanted is the same as in THIS post I can access the target by: oEvent.getSource()._event.target and then look if my target has class "sapUiIcon" and either return false or call another function.

enter image description here

THX for any advice hwo to access the target information ..

Community
  • 1
  • 1
ho.s
  • 751
  • 3
  • 17
  • 42

2 Answers2

1

I would use a CustomListItem instead and use a separate sap.ui.core.Icon with it's own press event.

But you probably need to check if the press from the listitem does not interfere with the press from the icon

Qualiture
  • 4,900
  • 7
  • 27
  • 38
1

You should use type ActiveAndDetail then you can attach your "detail" event handler(like press) only for the icon.

aborjinik
  • 723
  • 3
  • 5