Page 1 of 1

Dynamic format list item

Posted: Mon Dec 21, 2015 7:13 pm
by JimmyH

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


Dynamic format list item

Posted: Mon Dec 21, 2015 9:20 pm
by Alena Prykhodko

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.


Dynamic format list item

Posted: Tue Dec 22, 2015 4:29 am
by JimmyH

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


Dynamic format list item

Posted: Wed Dec 23, 2015 10:32 am
by Serhii Kulibaba

Hello,

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


Dynamic format list item

Posted: Wed Dec 23, 2015 9:36 pm
by JimmyH

Hi Sergiy,

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

Regards
James


Dynamic format list item

Posted: Thu Dec 24, 2015 12:31 pm
by Serhii Kulibaba

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