Announcement

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

    Questions on Export feature in listgrid

    Hi,

    I have some questions regarding the export feature in list grid.

    1) When the whole data is available on the client side shouldn't the export feature directly export the client side data instead of specifically calling the exportclientdata() to do it. It instead does a server side query though the client side has the whole data pertaining to that criteria.

    2) When the export output for the same data changes, it queries the database again. This need to be avoided. I export a data in CSV format and then in XLS, it queries twice.

    3) How to have multi-row, multi-column header in export file (XLS) using the setHeader in the DsRequest?

    4) Also when I have multi line header using <br> in column header title, the same appears in the Export file. How to correct this?

    Version: smartgwtee 3.0

    Thanks.
    Last edited by harsha.galla; 18 Jan 2012, 00:39.

    #2
    1. with exportClientData, data is transmitted to the server because data can only be downloaded from the server - the client cannot trigger a "Save As" dialog. This is also in order to do Excel export, which is necessarily a server-side function. However, there is no new database query.

    2. should not be the case, let us know how to reproduce this

    3. this is not currently supported with the default exports, but you could sponsor it. One approach would be a new API that allows you to get the POI object we put together from the data, then modify it before it's serialized to the browser.

    4. you can set DataSource.exportTitle to a title to be used only for export

    Comment


      #3
      Isomorphic,

      Thanks for the response.

      Regarding point 2), we have a query on a huge data table involving multiple joins etc. It would take 2 minutes to get the output. The output has around 270 rows only. I have dataPageSize set to 500 which renders all the 270 rows in one go. But when I try to export it in different formats it shows different RPC requests in the developer console, one for each format(Excel, CSV) and each of these requests take more are less the time it took for the list grid initially to query the database. This makes me think it's firing the query again for each export request. I need to validate this from database side. But is there a way to identify from my application code if a database query has actually happened on the server because there is a mismatch between what you have answered and what i see in the RPC tab in the console.

      thanks.

      Comment


        #4
        It makes no sense to look in the RPC tab, since exports contact the server regardless. Just look at the server log.

        Comment


          #5
          Isomorphic,

          Please find the attached log file. I have run a scenario and tried to export in each of format xls, xlsx and csv.

          In all the three cases I see the query formed etc etc. Only in the last CSV export scenario i see the export time logged.

          Can you verify and validate.

          I have removed some of the lines from the log due to size constraint :)..!

          Thanks.
          Attached Files

          Comment


            #6
            These are calls to exportData() not exportClientData(). See the docs - exportData() does a fetch.

            Comment


              #7
              Hi,

              I get it now. I was expecting it to work as filter functionality in listgrid with automatic switching between client and server. So here I need to explicitly check if all records are present client side and then call exportClientData() , if not use exportData().

              Am I right?

              Thanks.

              Comment


                #8
                Not necessarily, this is not just an optimization, the two have different behaviors. Start by reading the docs for each.

                Comment


                  #9
                  Ok, the difference between both is the client-side formatters being present or not.
                  So export by default runs a query again on the database when exportData() is used.

                  Thanks.

                  Comment

                  Working...
                  X