Sorting header columns not work fine

Hi to all,
unfortunately is happening to me a problem with a grid DHTMLX with sorting of the columns , the grid and the sorting of the columns is created properly, but at first click on the header for to start the sorting colums,the page returns me to the top, scrolling down return on header of table and click again and the visual remains on the grid without problem and perfect sorting .
You know someone explain to me the reason of the first click on header returned on top page and how to resolve it ?
the sortig code that I use is the following :

Thanks so much.


on grid creation you have to set the initial sort with:


otherwise the first click on the grid header will just do nothing, except from scroll to the very top of your grid.

Thank you so much for your answer.
I tried the code you suggested but I have another error
this.hdr.rows [0] is undefined

by chance you know what it depends on?

I tried with
myGrid.setSortImgState (true, 0);

and also as documentation with
myGrid.setSortImgState (true, 1);

but still the same error
this.hdr.rows [0] is undefined

Thanks again

Please, make sure that you are calling the setSortImgState() method after the grid is initialized.

yes, but result not change.
I also tried this but the first click always goes to the top page.

this my code:
var myGrid = new dhtmlXGridObject(“table”);
myGrid.setHeader(my fuction for json);

This problem I have only on browser FireFox with Chrome grid.setSortImgState(true,0); worked fine.

How I can resolve it?


Please, try to define the column sorting before the init of the grid.
if the problem still occurs for you please, provide with a complete demo, where the problem can be reconstructed locally.