toExcel function doesn't work

my demo here. but it doesn’t work. please help

	<script  src="dhtmlxGrid/codebase/dhtmlxgrid.js"></script>        
	<script  src="dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
	<
	<script src="js/dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
	<link rel="STYLESHEET" type="text/css" href="dhtmlxGrid/codebase/dhtmlxgrid.css">
	<link rel="stylesheet" type="text/css" href="dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
</head>
<body>

    <div id="grid" style="height:390px;"></div> 
    <a onclick="export();">Export</a>
    <script>
    
   var mygrid;
   mygrid = new dhtmlXGridObject('grid');
	mygrid.setImagePath("./js/dhtmlx/dhtmlxGrid/codebase/imgs/");
	........
	mygrid.loadXML("connector/get.php?id=3");
	mygrid.init();
	
	function export(){
		mygrid.toExcel('grid-excel-php/generate.php');
		
		};
    </script>
          </body>
          </html>

i downloaded grid-excel-php.zip and unpacked to web root folder. I didn’t change any file from grid-excel-php folder.
I think, path(toExcel(“grid-excel-php/generate.php”)) is correct. but i changed it differently and did’t work.

Hi,
please, describe more in details how it doesn’t work?
Does any javascript error occur?

no javascript error. when i clicking Export, there is not happen like click Export

else provide me working demo

Your code looks like correct. Please, provide complete demo, I will try to run it at local machine.

my complete demo here
Export.rar (1.58 MB)

Hi,
there are 2 problems in your demo:

  1. all grid extensions must be included at page after including dhtmlxgrid.js and dhtmlxgridcell.js.
  2. you should use another function name instead of ‘export’. Export is a reserved word which can’t be used as a function name.

thank you very much.

Hi Guys,
I am using dhtmlx grid in my application. I tried to use dhtmlx grid export excel option, But i am getting an error “mygrid.toExcel is not a function”. I am using dhtmlxGrid v.2.1 Professional edition. Should i buy the dhtmlxgrid_export.js to fix this error.

be sure to include dhtmlxgrid_export.js on the page.