Skip to Content

How to shade a items selected from a list

Hello community, i have a list and so i want to when i press one item this item change the background or change the color so i could identify what item did i press previously and if i press another this change color and the item before gets normal and so on, i'm reading some events from the documentation but i can't find something i know tables have this behave like "standard" but not the list . I tried sending an icon but dit not know how to remove that icon when i press another item

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 16 at 07:07 PM

    How are you not seeing this behavior? Here is the LIST control (sap.m.list)....

    https://sapui5.hana.ondemand.com/sdk/#/sample/sap.m.sample.ListSelection/preview

    ....and show the behavior you are describing. Which control are you using?

    Add comment
    10|10000 characters needed characters exceeded

    • Naoto Amari Christopher Solomon

      jajajja thanks , yes i figured it out :D to fire the event of a standarlistitem in a list you must add the propertie selectionChange="onEvent" and this event will trigged the item-event something like this

      <List 	headerText="Asesor" 
      	selectionChange="onSelectionChangeAsesor"
      	mode="SingleSelectMaster"
      	id="lAsesor" 
      	width="100%"
      	items="{/}"
      	noDataText="Sin Datos">
      	<items>
      	   <StandardListItem title="{Cod_asesor} - {Asesor_nomb}" press="onConsultarCitas" type="Active"/>
             </items>
      </List>
      onSelectionChangeAsesor : function(oEvt) {
      			var item = oEvt.getParameter("listItem");
      			item.firePress();
      		}
      This will fire the event onConsultarCitas of the item and at the same time keep shade the item :D hope this help someone else