Announcement

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

    [10.0] DataSource.exportData ignores exportFilename

    SmartClient Version: v10.0p_2014-10-06/EVAL Deployment (expires 2014.12.05_04.48.46) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

    Safari, Chrome (OSX)

    I've just noticed that DataSource.exportData ignores exportFilename, the downloaded file has name IDACall.xls

    #2
    Not reproducible in a quick check with the latest code and the Feature Explorer sample.

    Make sure you are using "exportFilename" not "exportFileName".

    If you're still experience an issue, try updating to the latest, try multiple browsers, and try different machines and/or a stock SDK instead of testing within your application project.

    Comment


      #3
      Hi, I've just discovered what causes the error to happen in my application.
      I was adding a specific parameter in all requests, like this:
      Code:
          isc.RPCManager.addClassProperties({
              actionURL: isc.RPCManager.actionURL + '?locale=' + 'it'
          });
      The URL of the request becomes:
      https://localhost:8443/Eleven/isomor...-08&isc_tnum=6

      ('servizi' is the value of exportFilename)

      If I comment out the above code, the file is downloaded with the correct name, and the URL is:
      https://localhost:8443/Eleven/isomor...-08&isc_tnum=6

      Is it a bug similar to this old thread? http://forums.smartclient.com/showth...t=16387&page=3

      Comment


        #4
        Are you seeing this behavior only in IE, and if so, what version(s)?

        IE has bugs where it will ignore the filename the server tells it to use via HTTP headers, necessitating putting the filename into the URL itself to make it work.

        Comment


          #5
          Actually I didn't find a browser where it's working:

          on OSX,
          - Firefox 32.0.3 downloads a file named 'IDACall'
          - Safari 7.1 downloads a file named 'IDACall.xls'
          - Chrome 38.0.2125.101 downloads a file named 'IDACall.xls'

          on Windows
          - IE 8 downloads a file named 'IDACall'
          - IE 11 on Parallels download a file named 'IDACall'

          Comment


            #6
            A simple test case: please add
            Code:
            isc.RPCManager.addClassProperties({
                actionURL: isc.RPCManager.actionURL + '?locale=' + 'it'
            });
            to the #exportFS sample from the showCase, then you could see that the downloaded file has name 'IDACall', with or without 'exportFilename' specified.
            Same behavior in those samples:
            - #formattedServerExport
            - #customExport

            Comment


              #7
              Please retest this with the most recent build from smartclient.com - we don't see this issue against that very latest build, and some changes were made on October 14 and 15 that, whilst not being specifically aimed at this issue, ought to address it.

              Comment


                #8
                SmartClient Version: v10.0p_2014-10-18/EVAL Deployment (expires 2014.12.17_14.26.18) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

                The issue is still there.

                Don't you see the issue in the online showCase http://www.smartclient.com/#exportFS if you add
                Code:
                isc.RPCManager.addClassProperties({
                    actionURL: isc.RPCManager.actionURL + '?locale=' + 'it'
                });
                at the very beginning of the code under export.js tab? (Chrome, Safari,...)

                Comment


                  #9
                  Yes, but that build is from October 12.

                  Comment


                    #10
                    SmartClient Version: v10.0p_2014-10-18/EVAL Development Only (expires 2014.12.17_14.26.18) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

                    just tried with the downloaded SDK, #FSexport sample, modified as:
                    Code:
                    isc.RPCManager.addClassProperties({
                        actionURL: isc.RPCManager.actionURL + '?locale=' + 'it'
                    });
                    
                    isc.ListGrid.create({
                        ID: "countryList",
                        width:500, height:250, top:50, alternateRecordStyles:true,
                        dataSource: worldDSExport,
                        autoFetchData: true,
                        fields:[
                            {name:"countryName", title:"Country"},
                            {name:"capital", title:"Capital"},
                            {name:"continent", title:"Continent"},
                            {name:"independence", title:"Nationhood"},
                            {name:"population", title:"Population"}
                        ],
                        showFilterEditor: true
                    });
                    
                    isc.DynamicForm.create({
                        ID: "exportForm",
                        width:300,
                        fields: [
                            { name: "exportType", title: "Export Type", type:"select", width:"*",
                                defaultToFirstOption: true,
                                valueMap: { 
                                    "csv" : "CSV" , 
                                    "xml" : "XML", 
                                    "json" : "JSON",
                                    "xls" : "XLS (Excel97)",
                                    "ooxml" : "OOXML (Excel2007)"
                                }
                            },
                            { name: "showInWindow", title: "Show in Window", type: "boolean", align:"left" }
                        ]
                    });
                    
                    isc.Button.create({
                       ID: "exportButton",
                       title: "Export",
                       left: 320,
                       click: function () {
                           var exportAs = exportForm.getField("exportType").getValue();
                           var showInWindow = exportForm.getField("showInWindow").getValue();
                           if (exportAs == "json") {
                               // JSON exports are server-side only, so use the OperationBinding on the DataSource
                               countryList.exportData({ operationId: "customJSONExport", 
                                   exportDisplay: showInWindow ? "window" : "download"});
                           } else {
                               // exportAs is not JSON, so we can set that with requestProperties
                               countryList.exportData({ exportAs: exportAs,
                                   exportDisplay: showInWindow ? "window" : "download"
                               });
                           }
                       }
                    });
                    on Mac OSX, Safari (just after a reset), it downloads a IDACall.csv file.

                    these are the server side logs:

                    Code:
                    === 2014-10-20 15:53:35,049 [80-2] INFO  RequestContext - URL: '/isomorphic/IDACall', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/7.1 Safari/537.85.10': Safari with Accept-Encoding header
                    === 2014-10-20 15:53:35,051 [80-2] DEBUG XML - Parsed XML from (in memory stream): 1ms
                    === 2014-10-20 15:53:35,053 [80-2] DEBUG RPCManager - Processing 1 requests.
                    === 2014-10-20 15:53:35,054 [80-2] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                        criteria:{
                        },
                        operationConfig:{
                            dataSource:"worldDSExport",
                            operationType:"fetch",
                            textMatchStyle:"substring"
                        },
                        exportResults:true,
                        exportAs:"csv",
                        exportDelimiter:",",
                        exportTitleSeparatorChar:"",
                        exportFilename:"Results.csv",
                        exportDisplay:"download",
                        lineBreakStyle:"default",
                        exportFields:[
                            "countryName",
                            "capital",
                            "continent",
                            "independence",
                            "population"
                        ],
                        exportFieldTitles:{
                            countryName:"Country",
                            capital:"Capital",
                            continent:"Continent",
                            independence:"Nationhood",
                            population:"Population"
                        },
                        exportRawValues:true,
                        exportCurrencySymbol:"$",
                        exportOtherFields:{
                            countryName:"Country",
                            capital:"Capital",
                            continent:"Continent",
                            independence:"Nationhood",
                            population:"Population"
                        },
                        exportPropertyIdentifier:"name",
                        appID:"builtinApplication",
                        operation:"worldDSExport_fetch",
                        oldValues:{
                        }
                    }
                    === 2014-10-20 15:53:35,054 [80-2] INFO  IDACall - Performing 1 operation(s)
                    === 2014-10-20 15:53:35,054 [80-2] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
                    === 2014-10-20 15:53:35,054 [80-2] DEBUG DeclarativeSecurity - DataSource worldDSExport is not in the pre-checked list, processing...
                    === 2014-10-20 15:53:35,055 [80-2] DEBUG AppBase - [builtinApplication.worldDSExport_fetch] No userTypes defined, allowing anyone access to all operations for this application
                    === 2014-10-20 15:53:35,055 [80-2] DEBUG AppBase - [builtinApplication.worldDSExport_fetch] No public zero-argument method named '_worldDSExport_fetch' found, performing generic datasource operation
                    === 2014-10-20 15:53:35,055 [80-2] INFO  SQLDataSource - [builtinApplication.worldDSExport_fetch] Performing fetch operation with
                    	criteria: {}	values: {}
                    === 2014-10-20 15:53:35,055 [80-2] INFO  SQLWhereClause - [builtinApplication.worldDSExport_fetch] empty condition
                    === 2014-10-20 15:53:35,056 [80-2] INFO  SQLDataSource - [builtinApplication.worldDSExport_fetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
                    === 2014-10-20 15:53:35,056 [80-2] INFO  SQLDataSource - [builtinApplication.worldDSExport_fetch] 79: Executing SQL query on 'HSQLDB': SELECT worldDS.pk, worldDS.countryCode, worldDS.countryName, worldDS.capital, worldDS.government, worldDS.continent, worldDS.independence, worldDS.area, worldDS.population, worldDS.gdp, worldDS.member_g8 FROM worldDS WHERE ('1'='1')
                    === 2014-10-20 15:53:35,057 [80-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.worldDSExport_fetch] DriverManager fetching connection for HSQLDB via jdbc url jdbc:hsqldb:file:/Users/bosticco/librerie/isc/10.0/SmartClient_v100p_2014-10-18_Evaluation/smartclientSDK/WEB-INF/db/hsqldb/isomorphic
                    === 2014-10-20 15:53:35,057 [80-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.worldDSExport_fetch] Passing JDBC URL only to getConnection
                    === 2014-10-20 15:53:35,057 [80-2] DEBUG PoolableSQLConnectionFactory - [builtinApplication.worldDSExport_fetch] makeObject() created an unpooled Connection '2083514439'
                    === 2014-10-20 15:53:35,057 [80-2] DEBUG SQLConnectionManager - [builtinApplication.worldDSExport_fetch] Borrowed connection '2083514439'
                    === 2014-10-20 15:53:35,058 [80-2] DEBUG SQLDriver - [builtinApplication.worldDSExport_fetch] About to execute SQL query in 'HSQLDB' using connection '2083514439'
                    === 2014-10-20 15:53:35,058 [80-2] INFO  SQLDriver - [builtinApplication.worldDSExport_fetch] Executing SQL query on 'HSQLDB': SELECT worldDS.pk, worldDS.countryCode, worldDS.countryName, worldDS.capital, worldDS.government, worldDS.continent, worldDS.independence, worldDS.area, worldDS.population, worldDS.gdp, worldDS.member_g8 FROM worldDS WHERE ('1'='1')
                    === 2014-10-20 15:53:35,077 [80-2] INFO  DSResponse - [builtinApplication.worldDSExport_fetch] DSResponse: List with 216 items
                    === 2014-10-20 15:53:35,083 [80-2] DEBUG ConfigParser - Matched var name: webRoot
                    === 2014-10-20 15:53:35,083 [80-2] DEBUG ConfigParser - value after substitution: /Users/bosticco/librerie/isc/10.0/SmartClient_v100p_2014-10-18_Evaluation/smartclientSDK
                    === 2014-10-20 15:53:35,083 [80-2] INFO  ProxyHttpServletResponse - content-disposition set to: attachment;  - unwrapping response output stream (CompressionFilter)
                    === 2014-10-20 15:53:35,170 [80-2] DEBUG DataExport - Export took 86ms
                    === 2014-10-20 15:53:35,170 [80-2] DEBUG SQLDriver - Freeing SQLDriver dbConnection 2083514439
                    === 2014-10-20 15:53:35,171 [80-2] DEBUG SQLConnectionManager - About to close JDBCConnection with hashcode "2083514439"
                    === 2014-10-20 15:53:35,266 [80-3] INFO  RequestContext - URL: '/isomorphic/skins/Enterprise/images/DynamicForm/checkbox_sprite.png', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/7.1 Safari/537.85.10': Safari with Accept-Encoding header
                    === 2014-10-20 15:53:35,266 [80-2] INFO  RequestContext - URL: '/isomorphic/system/reference/skin/images/server_client_exchange.png', User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/7.1 Safari/537.85.10': Safari with Accept-Encoding header
                    === 2014-10-20 15:53:35,270 [80-2] INFO  Download - done streaming: /Users/bosticco/librerie/isc/10.0/SmartClient_v100p_2014-10-18_Evaluation/smartclientSDK/isomorphic/system/reference/skin/images/server_client_exchange.png
                    === 2014-10-20 15:53:35,270 [80-3] INFO  Download - done streaming: /Users/bosticco/librerie/isc/10.0/SmartClient_v100p_2014-10-18_Evaluation/smartclientSDK/isomorphic/skins/Enterprise/images/DynamicForm/checkbox_sprite.png
                    and this is the RPCRequest from the developer console:
                    Code:
                    {
                        "actionURL":"http://localhost:8080/isomorphic/IDACall?locale=it", 
                        "showPrompt":false, 
                        "transport":"hiddenFrame", 
                        "promptStyle":"cursor", 
                        "bypassCache":true, 
                        "data":{
                            "criteria":{
                            }, 
                            "operationConfig":{
                                "dataSource":"worldDSExport", 
                                "repo":null, 
                                "operationType":"fetch", 
                                "textMatchStyle":"substring"
                            }, 
                            "exportResults":true, 
                            "exportAs":"csv", 
                            "exportDelimiter":",", 
                            "exportTitleSeparatorChar":"", 
                            "exportFilename":"Results.csv", 
                            "exportPath":null, 
                            "exportDisplay":"download", 
                            "lineBreakStyle":"default", 
                            "exportFields":[
                                "countryName", 
                                "capital", 
                                "continent", 
                                "independence", 
                                "population"
                            ], 
                            "exportHeader":null, 
                            "exportHeaderless":null, 
                            "exportFooter":null, 
                            "exportFieldTitles":{
                                "countryName":"Country", 
                                "capital":"Capital", 
                                "continent":"Continent", 
                                "independence":"Nationhood", 
                                "population":"Population"
                            }, 
                            "exportDatesAsFormattedString":null, 
                            "exportRawValues":true, 
                            "exportCurrencySymbol":"$", 
                            "exportHeaderSpans":null, 
                            "exportOtherFields":{
                                "countryName":"Country", 
                                "capital":"Capital", 
                                "continent":"Continent", 
                                "independence":"Nationhood", 
                                "population":"Population"
                            }, 
                            "exportWrapHeaderTitles":null, 
                            "exportPropertyIdentifier":"name", 
                            "appID":"builtinApplication", 
                            "operation":"worldDSExport_fetch", 
                            "oldValues":{
                            }
                        }
                    }
                    this is the URL of the request as logged in the Safari inspector console:

                    http://localhost:8080/isomorphic/IDA...-18&isc_tnum=3
                    Last edited by claudiobosticco; 23 Oct 2014, 08:08.

                    Comment


                      #11
                      Ok, we see it now - we'll update here when we have it fixed.

                      Comment


                        #12
                        This is now fixed and will appear in the Oct 23, 2014 builds of 10.0, 9.1 and their SGWT counterparts.

                        Thanks for the clear bug report!

                        Comment


                          #13
                          SmartClient Version: v10.0p_2014-10-23/EVAL Deployment (expires 2014.12.22_09.35.28) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

                          verified, thank you very much

                          Comment


                            #14
                            mh, there's something strange going on: when exporting on Windows machine (IE, Chrome), the downloaded file lacks the extension if the exportFilename is specified. Without specifying the exportFilename, the file extension is there.

                            But unfortunately it seems that I can't reproduce it in the showCase :-(

                            Comment


                              #15
                              Nope, I'm wrong. It is reproducible with this test case.

                              SmartClient Version: v10.0p_2014-10-23/EVAL Development Only (expires 2014.12.22_09.35.28) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

                              Chrome, IE11 on Windows 7

                              Modify the #FSexport sample like this

                              Code:
                              isc.RPCManager.addClassProperties({
                                  actionURL: isc.RPCManager.actionURL + '?locale=' + 'it'
                              });
                              
                              isc.ListGrid.create({
                                  ID: "countryList",
                                  width:500, height:250, top:50, alternateRecordStyles:true,
                                  dataSource: worldDSExport,
                                  autoFetchData: true,
                                  fields:[
                                      {name:"countryName", title:"Country"},
                                      {name:"capital", title:"Capital"},
                                      {name:"continent", title:"Continent"},
                                      {name:"independence", title:"Nationhood"},
                                      {name:"population", title:"Population"}
                                  ],
                                  showFilterEditor: true
                              });
                              
                              isc.DynamicForm.create({
                                  ID: "exportForm",
                                  width:300,
                                  fields: [
                                      { name: "exportType", title: "Export Type", type:"select", width:"*",
                                          defaultToFirstOption: true,
                                          valueMap: { 
                                              "csv" : "CSV" , 
                                              "xls" : "XLS (Excel97)"
                                          }
                                      },
                                      { name: "showInWindow", title: "Show in Window", type: "boolean", align:"left" }
                                  ]
                              });
                              
                              isc.Button.create({
                                 ID: "exportButton",
                                 title: "Export",
                                 left: 320,
                                 click: function () {
                                     var exportAs = exportForm.getField("exportType").getValue();
                                     var showInWindow = exportForm.getField("showInWindow").getValue();
                                         // exportAs is not JSON, so we can set that with requestProperties
                                         countryList.exportData({ exportAs: exportAs,
                                             exportDisplay: showInWindow ? "window" : "download", exportFilename:"testcase"
                                         });
                                 }
                              });
                              The downloaded file, for xls and csv only, has name 'testcase' without extension.

                              On MAC OSX it's working (that's why at first I've reported it as verified).

                              Comment

                              Working...
                              X