Peter LPunkt
Posts: 0
Joined: Mon Jan 13, 2014 3:07 pm

change background color of individual gridcells by localstorage value

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.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

change background color of individual gridcells by localstorage value

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

Peter LPunkt
Posts: 0
Joined: Mon Jan 13, 2014 3:07 pm

change background color of individual gridcells by localstorage value

As always, thanks for the promt solution.
Cheers

Return to “Issues”