Announcement

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

    Problems resetting criteria and then exportingClientData

    1. SmartGWT 2.5

    2. Developer Console - SmartClient Version: SC_SNAPSHOT-2011-07-12/Pro Deployment (built 2011-07-12)

    3. Error Transport error - HTTP code: 0 for URL: /pc2/sc/IDACall?sessionToken

    4. Code sample
    Button downLoadButton = new Button();
    downLoadButton.setTitle("Download");
    downLoadButton.addClickHandler(
    new ClickHandler(){
    @Override
    public void onClick(ClickEvent event) {
    String status = StatusRadioGroup.getValueAsString();
    //several attempts made with ListGrid.clearCriteria();
    if(status.equalsIgnoreCase("NOCRITERIA")){
    System.out.println("Search Criteria only for download");
    }
    else {
    ListGrid.clearCriteria();
    Criteria downloadCriteria = new Criteria();

    if(status.equalsIgnoreCase("ALL")){
    //ListGrid.invalidateCache();
    downloadCriteria.addCriteria("STATUS", Status.NEW.toString());
    downloadCriteria.addCriteria("STATUS", Status.OLD.toString());
    }
    if(status.equalsIgnoreCase("OLD")){

    downloadCriteria.addCriteria("STATUS", Status.OLD.toString());
    }
    if(status.equalsIgnoreCase("NEW")){
    downloadCriteria.addCriteria("STATUS", Status.NEW.toString());
    }
    //Several attempts made commenting out invalidateCache/clearCriteria
    ListGrid.invalidateCache();
    ListGrid.setCriteria(downloadCriteria);
    ListGrid.fetchData(downloadCriteria);
    }

    DSRequest dsRequestProperties = new DSRequest();

    String fileFormat = fileFormatRG.getValueAsString();

    if(fileFormat.equalsIgnoreCase("CSV")){
    dsRequestProperties.setExportAs(ExportFormat.CSV);
    }
    if(fileFormat.equalsIgnoreCase("EXCEL")){

    dsRequestProperties.setExportAs(ExportFormat.XLS);
    }
    dsRequestProperties.setDataSource("product_DS");
    dsRequestProperties.setExportDisplay(ExportDisplay.DOWNLOAD);
    dsRequestProperties.setExportFilename("Products-" + statusRG.getValueAsString());
    // attempts made using this finction instead of exportClientData
    //ListGrid.exportData(dsRequestProperties);
    ListGrid.exportClientData(dsRequestProperties);

    }
    }
    );
    Last edited by Mitch B; 4 Jan 2012, 09:57.

    #2
    This looks like it might be due to special characters in the fileName which are not valid in a URL. If so, grab the latest patched 2.5 from smartclient.com/builds, it should fix this.

    Comment

    Working...
    X