cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 - Display different icons in ColumnListItem

yes_sapteam
Participant
0 Kudos

Hello experts,

I have an application that getting a table of data from Ecc and displaying it in a table.

in the table all the data displayed ColumnListItem.

one field content is icon for example : "sap-icon://multiselect-all".

The problem is that the icon is not displayed in the table .

<items>
		<ColumnListItem
			type="Navigation"
			press="onPress">
			<cells>
	   		<Text
	         	    text="{Xblnr}"/>
		       <Text 
			    text="{Bldat}"/>
		       <Text
			    text="{Wrbtr}"/>
	               <Text
			    text="{Waers}"/>
		       <Text
			    text="{Invoice_Name}"/>
		       <Text
			    text="{CREATE_DATE}"/>	
		       <Text
			    text="{Status}"/>
		       <Text	
			    text="{Status_Url}"
			    src="{Status_Url}"				
			    icon="{Status_Url}"/>		    
			</cells>	
		</ColumnListItem>
	</items>

is it possible to display different icons in the table lines?

Thank you.
View Entire Topic
former_member182862
Active Contributor
0 Kudos

Sorry I am confused with what you are doing

		       <Text	
			    text="{Status_Url}"
			    src="{Status_Url}"				
			    icon="{Status_Url}"/>

why do you have icon and src properties in sap.m.Text control?

-D

yes_sapteam
Participant
0 Kudos

Hello,

I am new to this world of ui5.

But i have a task to do.

I look at the example in step 15

but its still not working for my.

<items>

<ColumnListItem

type="Navigation" press="onPress">

<cells>

<Text text="{Xblnr}"/>

<Text text="{Bldat}"/>

<Text text="{Wrbtr}"/>

<Text text="{Waers}"/>

<Text text="{Invoice_Name}"/>

<Text text="{CREATE_DATE}"/>

<Text text="{Status}"/>

<Text text="{Status_Url}" factory= "{.productListFactory}"/>

</cells> </ColumnListItem>

I also add code in the Main.Controller

productListFactory : function(sId,oContext) {

var oUIControl = null;

// This item is out of stock and discontinued

//

if (oContext.getProperty("Status_Url") === 1 ) {

// Yup, so use a

// StandardListItem

oUIControl = new sap.m.StandardListItem(sId, {

icon : "sap-icon://warning",

infoState : "Error"

});

return oUIControl; } },

Any help will be appreciated.

Thank you.

Sharathmg
Active Contributor
0 Kudos

You are trying to put the image in a text control. Replace the text tag with image tag.

Use the column item of type image and then assign the url to the image.

Regards,

Sharath

yes_sapteam
Participant
0 Kudos

Hello Sharath,

Thank you for the answer.

I changed the code but its not working for me.

in the .XML

<items>
	<ColumnListItem
	   type="Navigation"
	   press="onPress">
	<cells>
	  <Text
	    text="{Xblnr}"/>
	<Text 
	    text="{Bldat}"/>
	<Text
	    text="{Wrbtr}"/>
	<Text
	    text="{Waers}"/>
	<Text
	    text="{Invoice_Name}"/>
	<Text
	    text="{CREATE_DATE}"/>	
	<Text
	    text="{Status}"/>
	<Image	
	    image="{Status_Url}"
	    factory= "{.productListFactory}"/> 	  					   
	</cells>
	   </ColumnListItem>
			</items>

In The controller.js
productListFactory : function(sId,oContext) {
		var oUIControl = null;
		// 
		if (oContext.getProperty("Status_Url") === 1 ) {
		// Set icone
		oUIControl = new sap.m.StandardListItem(sId, {
		icon : "sap-icon://warning",
		infoState : "Error"
			});
			return oUIControl;
			
		}	
	},

Can you help me with the code?
Thank you.