Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Treegrid Export

    Dear Admin/Isomorphic/Jeevan
    Version : SmartGWT Pro

    We are trying to export treegrid data in excel. It is only showing the column headings of the treegrid in the excel but no data.

    Code:
    	final TreeGrid resultGrid = new TreeGrid();
            resultGrid.setShowConnectors(true);
        	resultGrid.setShowResizeBar(false);
        	resultGrid.setShowHeaderContextMenu(false);
        	resultGrid.setFilterByCell(false);
        	resultGrid.setAlternateRecordStyles(true);
        	resultGrid.setAutoFitMaxColumns(4);
        	//resultGrid.setCanFreezeFields(true);
            resultGrid.setCanReparentNodes(false);     
        	resultGrid.setShowHeaderMenuButton(false);
        	resultGrid.setSmoothFade(Boolean.FALSE);
            resultGrid.setNodeIcon("icons/16/person.png");
            resultGrid.setFolderIcon("icons/16/person.png");        
        	resultGrid.setShowRecordComponents(true);        
        	resultGrid.setLoadDataOnDemand(true);
            resultGrid.setDataSource(daReportDS);
    
    	expBtn.addClickHandler(new ClickHandler() {
            	
                public void onClick(ClickEvent event) {
                	SC.say("Grid Size() "+resultGrid.getRecords().length);
                	if(resultGrid.getRecords().length > 0){	
    			String exportAs = "csv"; 
    			DSRequest dsRequest = new DSRequest();
    			dsRequest.setExportAs((ExportFormat)EnumUtil.getEnum(ExportFormat.values(), exportAs));
    			dsRequest.setExportFilename(fileName+".csv");
    			dsRequest.setExportDisplay(ExportDisplay.DOWNLOAD);
    			
    			resultGrid.exportData(dsRequest);
                	}else{
                		SC.say("No data for export. <br> Please select valid filter criteria");
                	}
                }
            });
    Our Listgrid functionality is working with the same code.

    Can you suggest us the solution here.

    Waiting for reply,
    Thanks,
    Anurag
    Last edited by anurag_agarwal; 27 May 2011, 12:06.

    #2
    Working fine in a brief test. You omitted basically all of the required information (see FAQ).

    Comment

    Working...
    X