Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Marta Regge on Jan 16, 2010 05:43
open dhtmlx forum
erratic paging behaviour

I'm trying to use paging but I'm getting strange results:
I create the grid this way:
grid = new dhtmlXGridObject("tabella");
    grid.setImagePath("/js/dhtmlx/imgs/");
    s = dhxLayout.cells("b").getHeight()-100;
    grid.enableAutoHeight(true,s,s);
    grid.init();
    grid.enableMultiline(true);
    grid.enableAutoWidth(true);
    grid.setSkin("modern");
    grid.enablePaging(true,20,10,"footer",true);
    grid.setPagingSkin("bricks");
    grid.setAwaitedRowHeight(70);
    url = "xml.xml?....";
    grid.loadXML(url)
    grid.setSizes();

The grid loads ok, paging is correct but:
if I click on page 2 it loads it but then goes back to page 1. if I click on other pages after that if I see a trace if activating onBeforePageChanged but it doesn't do anything.
grid.attachEvent("onBeforePageChanged", function(a,b) {
alert (a+','+b)
});
the strange thing is that switching from page 1 to 2 it alerts first "1,2" then "2,1" in other cases it alerts just once and does nothing.
thank you

Answer posted by Alex (support) on Jan 18, 2010 01:45

onBeforePageChanged event handler should return true to confirm page change:

grid.attachEvent("onBeforePageChanged", function(a,b) { 

alert (a+','+b) 

return true

});