JimmyH
Posts: 0
Joined: Sun Jan 25, 2015 5:01 am

Dynamic format list item

Hi there,

I would like to conditionally format a list item based on a value in local storage.
For example, if the value assigned to the list item is in your "favourites" list (ie local storage), I would like that list item to be assigned a colour.

Can you please help.

thanks
james

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Dynamic format list item

Hello,

You need to apply different CSS styles according to required condition defined, you will find here how to style List component background, for example https://devcenter.appery.io/documenta..., you can add any CSS you need.

Add custom JavaScript state and according to this apply different CSS.

JimmyH
Posts: 0
Joined: Sun Jan 25, 2015 5:01 am

Dynamic format list item

Hi Alena,

Thanks for your response.

That example does not specify for a single list item, but rather the whole list.

On page load I tried the following:

Apperyio("ListItem").css("background-color","linear-gradient(#00FF00, #00FF00)");

but it did not work even for the whole list.

I know that this works for other components though as I tested it on a button (obviously swapping the component name).

I actually want the colour for a list item to change depending on a label value that is mapped to the list item.

Any thoughts?

thanks
James

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Dynamic format list item

Hello,

Please use "page show" event instead of "load"

JimmyH
Posts: 0
Joined: Sun Jan 25, 2015 5:01 am

Dynamic format list item

Hi Sergiy,

I have tried that as well, but it didn't work.

Regards
James

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Dynamic format list item

Please use property "background" instead of "background-color":
preApperyio("ListItem").css("background","linear-gradient(#00FF00, #00FF00)");/pre

Return to “Issues”