cancel
Showing results for 
Search instead for 
Did you mean: 

How to shade a items selected from a list

naotoxxx
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

ChrisSolomon
Active Contributor

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?

naotoxxx
Participant

Hi Christopher Solomon, i forgot the propertie mode="SingleSelectMaster" on my list so that was all the problem ! thanks! ! !

naotoxxx
Participant
0 Kudos

the only problem now i'm facing it's when i press an item this does not fired my event

ChrisSolomon
Active Contributor
0 Kudos

You will figure it out...I have faith in you! 😃

naotoxxx
Participant
0 Kudos

jajajja thanks , yes i figured it out 😄 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 😄 hope this help someone else

Answers (0)