Export to Excel not working

Hi,
I have deployed the war file given in “http://dhtmlx.com/x/download/regular/grid-excel-java.zip” in server

and used in the code as follows



var mygrid2;
function doInitGrid(){
mygrid2 = new dhtmlXGridObject(‘mygrid_container2’);


mygrid2.init();
mygrid2.loadXML(" …");
}
window.onload =doInitGrid;

but the download to excel functionality is not working . Please help me on this

Hi,
does any JavaScript or Java error occur?
By the way:

onclick="mygrid2.toExcel('generate', 'yellow');"

the second parameter is color scheme. It should be one of predefined: full_color, color, gray, bw.

Hi,
In my local machine i copied war file given in “http://dhtmlx.com/x/download/regular/grid-excel-java.zip” and then build the project. When I click on “Get As Excel"button in my localhost I am not able to see anything except a jvascript error"Object doesn’t support this property or method”. I am using JDK1.5.

Hi,
could you provide me complete demo (without server side, only client)?

Hi,
I have attached a sample code i used and the xml
sample.zip (7.4 KB)

Hi,
please, add method getTitle() into excell price like here:

function eXcell_myprice(cell) {
   this.base = eXcell_price;
   this.base(cell);
   this.setValue = function(val) {
        
        if(val.toString().trim()==""){
          val = " ";
          this.cell.innerHTML = val; 
       } 
      else if (val >= 0){
           this.cell.style.color = "green";
           val="$"+thousandSeparator(val)+"K";
           this.cell.innerHTML = val;
       }
       else if(isNaN(val)){ 
         val = " "; 
         this.cell.innerHTML = val;
      }
       else{
           this.cell.style.color = "red";
           val="$"+thousandSeparator(val)+"K";
           this.cell.innerHTML = val;
       }
       this.cell.innerHTML = this.grid._aplNF(val, this.cell._cellIndex);
   }
   
   this.getTitle = function() {
	   return this.cell.innerHTML;
   };
}

Hi,
Thanks a lot. It worked but the header section in the excel is getting repeated at the end of the data in the excel . How can we remove this? and onclick of the button a window also gets opened up. Need to close this window(this is the /generate window) as well. Please help

Hi,
try to update grid-excel-java from here:
viewtopic.php?f=23&t=20151

and file dhtmlxgrid_export.js from attachment.
dhtmlxgrid_export.zip (2.89 KB)