Page 1 of 1

change background color of individual gridcells by localstorage value

Posted: Thu Apr 10, 2014 9:58 am
by Peter LPunkt

Hi there,

i dont know what i am missing...

I have some localstorage variables which change from 0 to 1 if a mobile toggle is selected. On a different page i want to set the backgroundcolor of single gridcells to red or green, depending on the value of the localstorage variable.

Following js on page load:
var planw11m = localStorage.getItem('planw11m'); //to get localstorage value

if (planw11m == 1) Appery('mobilegridcell_35').css('background-color', '#32CD32');// if variable planw11m equal 1, set background to green

In the editor i have set the backgroundcolor of the cell mobilegridcell_35 (mobilegrid_33 is the name of the grid) to red (#ff0000).

In browser i can see that the localstorage value is set.


change background color of individual gridcells by localstorage value

Posted: Thu Apr 10, 2014 11:21 am
by Maryna Brodina

Hello!

It's not possible to call Grid cell through Appery. Try this way prevar planw11m = localStorage.getItem('planw11m');
if (planw11m == "1") {
$('[name=mobilegridcell_35]').css('background-color', '#32CD32');
}/pre


change background color of individual gridcells by localstorage value

Posted: Thu Apr 10, 2014 1:49 pm
by Peter LPunkt

As always, thanks for the promt solution.
Cheers