Close a windows from a grid event

I have a window which contains a grid in my page and wich opens when I press a button.

I want to close the windows when the user clics a row in the grid.



I’ve tried to inicialize the dhxWins varible outside the function but I get an error.



Thanks for your help.

Nerea



function buscar_Viajes(){

            

            var dhxWins = new dhtmlXWindows();         

            dhxWins.enableAutoViewport(false);

            dhxWins.setViewport(90, 90, 435, 315);

            dhxWins.vp.style.border = “#909090 0px solid”;    

        

            var w1 = dhxWins.createWindow(“w1”,5, 5, 425, 305);        

            // hiding button max, min y contraer

            w1.button(“minmax1”).hide();

            w1.button(“minmax2”).hide();

            w1.button(“park”).hide();        

             //No permite

            w1.denyResize(); // deny resizing

            w1.denyMove(); // deny moving             

            w1.setText(“Seleccionar Viaje”);        

                  

            var grid = w1.attachGrid();

            grid.setEditable(true);

            grid.setSkin(“light”);

            //enable tooltips for last column

            grid.enableTooltips(“false,false,false,false,false,false,false,true”);    

         //moverse entre las filas con el teclado

            grid.enableKeyboardSupport(true);        

            //seleccionar fila con dobleclick

            grid.attachEvent(“onRowDblClicked”,doOnRowDblClickedV);

            grid.attachEvent(“onEnter”,doOnEnterV);

            grid.setExternalTabOrder(“bViajes”,“cmb_receipt”);

            //tabulacion

            grid.enableEditTabOnly(1);

            //solo se puede seleccionar uno    

            grid.enableMultiselect(false);        

            grid.loadXML(“buscarViaje.php”);    

                            

        }









Make dhxWins global viriable.


When I put dhxWins = new dhtmlXWindows();   outside the function I get the following error when executing the BuscarViajes() function



‘dhxWins’ is not defined.



How can I declare It outside the function?

I wasn’t inicializing the variable after the tag. Now it works thanks!!!