Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by BAPU SHINDE on Nov 14, 2008 04:35
open dhtmlx forum
Problem for loading dhtmlx grid dynamically , i have error on handling onXLS Event for URL loading to load next rows from server

Hi,
As per your reply for loading dhtmlx grid dynamically I have handle "onXLS" event for loading dhtmlx grid. but it gives message
as "Stack overflow at line 5328" i have attached code herewith. Please do comment on it.

is any file missing or wrong with my code.?

    function LoadGrid()

    {

        try

        {

        

            mygrid = new dhtmlXGridObject('BigGrid');

            mygrid.setImagePath("../IMAGES/imgs");

            mygrid.setHeader("Index,First Name,Last Name");

            mygrid.setInitWidths("100,100,100")

            mygrid.setColAlign("center,center,center")

            mygrid.setColTypes("ro,ro,ro");

         //mygrid.setOnLoadingStart(function(){ document.getElementById("a_1").style.display="block"; });

         //mygrid.setOnLoadingEnd(function(){ document.getElementById("a_1").style.display="none"; });

            mygrid.setSkin("light");

            mygrid.init();

         mygrid.enableSmartRendering(true , 327682 , 1000);

         mygrid.loadXML("/WorkFlow/servlet/SmartRenderingServlet?Pos_Start="+Pos_Start+"&Total_Count="+TotalCount);

            

            //alert(mygrid.posStart);

            //Pos_Start += 1000;

            mygrid.attachEvent("onXLS" ,

            function ( x,y)

            {

             var state = mygrid.getStateOfView();

             //alert(state[0]);

                 mygrid.loadXML("/WorkFlow/servlet/SmartRenderingServlet?Pos_Start="+state[0]);

                 return false;

            }


//the following event not handled by my code
/*        mygrid.attachEvent("onDynXLS" ,
            function ( pos,count)
            {
             var state = mygrid.getStateOfView();
             //alert(state[0]);
                 mygrid.loadXML("/WorkFlow/servlet/SmartRenderingServlet?Pos_Start="+state[0]);
                 return false;
            }


            );

*/                    

        }//try

        catch(e)

        {

            alert(e);

        }//catch(e)

    

    }


//Following are solutions gave by you but not working in my application.


In any moment of time you can call
var state = grid.getStateOfView();
state[0] - current top row
There is an onScroll event, so you can catch the moment when scroll state of grid was changed.

Also, there is onDynXLS event, it occurs when grid request new data from server.
mygrid.attachEvent("onDynXLS",function(pos,count){
mygrid.loadXML(any custom server side url here);
return false;
})



If you mean dhtmlxgrid.

grid.attachEvent("onScroll",function(x,y){
alert(y);
});



Answer posted by Support on Nov 14, 2008 07:20
a) in code above you need to use onDynXLS event instead of onXLS ( onXLS event can't be blocked, and occurs for all loading calls , not only for dyn. data loading ) 
b) instead of state[0] you can use 

  mygrid.attachEvent("onDynXLS" , function (pos,count){
     mygrid.loadXML("/WorkFlow/servlet/SmartRenderingServlet?Pos_Start="+pos);
     return false;
  });