0

In my application, I'm using gmaps4jsf 1.1.4. The map works fine. However, I can't get map's component values via JavaScript so that I could do the related changes to the components. For example,

document.getElementById("myForm:gMap").rendered = "false";
document.getElementById("myForm:gMap").rendered = "true";

does not work. What I want to do is that when the page is loaded in app, the map is not shown. That is, map renderer is false. The map will be displayed when a button is pressed in that page. Therefore, I want to enable and disable the map via JavaScript code. Is such thing possible?

nudastack
  • 155
  • 1
  • 5
  • 18
  • from js you can control its `hide` attribute, like this `$("myForm\\:gMap").hide();` and `$("myForm\\:gMap").show();` , `rendered` is not js/html attribute , but a JSF... – Daniel Jul 08 '13 at 10:58
  • It's working but with a small defect. In my bodyload JS function I'm trying to hide the map at the begining. However, while page is loading, the map is shown for 1 second then it is hidden. The reason why I wanted to control it by renderer was this defect. Initially, the renderer is false and it will be true after the button is submitted via JS function. Can I control the map with renderer or any other way so that it won't be displayed at all while page is loading. Thank you in advance. – nudastack Jul 08 '13 at 11:24
  • you can use `style="display:none;"` (or define css class) then use the `$("myForm\\:gMap").show();` – Daniel Jul 08 '13 at 11:44
  • I have already used style="display:none;". It still displays the map for a moment and then hides it. The only way that the map becomes hidden is when I set the rendered="false" but I cannot reach the map to set the rendered="true" when a button is pressed. – nudastack Jul 08 '13 at 11:50
  • check `style="display:none !important;"` looks like your css being overridden, weird... – Daniel Jul 08 '13 at 11:54
  • I actually replaced the css with your suggested js functions. It was still the same. – nudastack Jul 08 '13 at 11:58

0 Answers0