dhtmlxWindows + Grid + ToolBar + StatusBar = long time close

Hello all!
I have some problem: dhtmlxWindows with attach grid, toolBar and statusBar is closing very long time.This occurs only when the grid has more than 1000 rows. Otherwise all good. And more, if grid has more than 2000 rows export to EXCEL and PDF not work. What can I do with this?
Here is the JS code:

var dhxWins, win, mygrid, toolbar, statusBar;
var count = 0;

function createWindow()

	var winId = "win" + count;

	dhxWins = new dhtmlXWindows();
    dhxWins.setEffect("move", true);
	win = dhxWins.createWindow(winId, 50, 70, 400, 350);	//(id, x, y, width, height)
    win.setText("Встроенная таблица в окно");

	//mygrid = new dhtmlXGridObject("gridbox");
	mygrid = win.attachGrid();
	mygrid.setHeader("№, ID, NAME");
	mygrid.setSkin("dhx_skyblue");  //modern

	toolbar = win.attachToolbar();
    toolbar.addButton("excel", 0, "Експорт в Excel", "export_excel.png", "export_excel.png");
    toolbar.addSeparator("sep1", 1);
    toolbar.addButton("pdf", 2, "Експорт в PDF", "export_pdf.png", "export_pdf.png");
    toolbar.attachEvent("onClick", function(id)
    	if(id == "excel")
        else if(id == "pdf")
    statusBar = win.attachStatusBar();
    statusBar.setText("Количество строк: рассчитываю...");
    mygrid.attachEvent("onXLE", function()	//Когда таблица полностью загрузилась
    	statusBar.setText("Количество строк: " + mygrid.getRowsNum());

Thanks in advance for your help!

PS: sorry for my English - I’m from Ukraine :slight_smile:


to improve Grid performance you may try to enable Smart Rendering:

  • you should include dhtmlxgrid_srnd.js extention
  • and include the following line in your code:

This line should be included before load() method

Export to Excel and PDF works for 2000-row grid. However, probably you will need to increase memory_limit in php.ini

Alexandra, thanks for reply.

I thought about SmartRendering earlier, but I need after load grid to show in StatusBar real count of rows returned from database query. Is very important.
And I thought about use paging, need to try. :slight_smile:

As for export - I think need to write little php class that will send a similar query to the database what display a grid. On return result is write to Excel without style. It take less time and memory to perform.

I did not mean dynamic loading when only part of records are loaded at once. You can leave server-side implementation as is. Just enable Smart Rendering - in this case all data will loaded at once, but rows will be rendered on demand. Do not worry about getRowsNum() - it will return a correct value.

yes-yes, I tried SmartRendering and it’s help for performance nice and all data display correct, and even with filter. Now windows is close quick and big grid is load quick. Simply, I thought will pull data SmartRendering parts.

As for export - in excel I will write myself, because standard method is take many time and memory on client side.
Export to PDF - Browser is throws warning window about execution sceneries (Stop or continue). Or write something like this (Undefined index “grid_xml”). I think point is that not enough memory, although ini_set(‘memory_limit’, ‘450M’). What advice about that?

PS: Maximum count of rows in grid is may be not more 10000.


yes, I guess memory limitation could stop exporting data. Also it may be a problem with maximum upload file size. But exporting 10k rows it’s not the best idea anyway.
Actually grid.toPDF() takes only rendered rows, not all. There is a way to customize code and to add some limitation (for example 1000 rows).
Please, describe which behavior would be the best for you.