[OpenLayers-Users] Re: CQL filter and StyleMap

gabriel gpetricek at gmail.com
Tue Mar 13 10:40:27 EDT 2012


I solved the problem, but i have new now. I have button for fitering

var filtrovanie = new OpenLayers.Control.Button(
                        {
                          title:"Filtrovať objekty",
                          displayClass:"filter",
                          trigger:function()
                           {
                            var okno = window.prompt("Zadaj filter: ");
                            var format = new OpenLayers.Format.CQL();
                            var hid = document.getElementById("hid").value;
                            hid = okno;
                            var filter = format.read(hid);
                            
                            if(filter)
                            {
                             for(key in layers)
                             {
                              var style = new OpenLayers.Style(
                                          null, {rules:[rule]});
                              rule.filter = filter;
                              var stylemap = new OpenLayers.StyleMap({
                                            "default": style});  
                              layers[key].styleMap = stylemap;
                              layers[key].redraw();
                             }} 
                            return false; 
                            }  
                        });

And i need another button for reseting/destroying filter. 
I tried this, but it didnt work. 

var vratenie_hodnot = new OpenLayers.Control.Button(
                                 {
                                 title:"Resetovať filter",
                                 displayClass:"filter_off",
                                 trigger:function()
                                  {
                                    for(key in layers)
                                    {
                                      var filter = new OpenLayers.Filter();
                                      filter.destroy();
                                      //layers[key].redraw();
                                    }  
 }
                                  });

Where im making mistake/s? 

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/CQL-filter-and-StyleMap-tp4570643p4574198.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list