Announcement

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

    Problem with exportClientData in TreeGrid

    SmartClient Pro v11

    We have a fairly beefy TreeGrid that probably lists 20 pages of data in total, with maybe a dozen levels deep.

    We have a button for the user to click that will use exportContent() to send that canvas back to the server and create a PDF file.

    It seems that when the grid content that is open and expanded gets beyond a certain size, the length of time it takes to accomplish this gets exponentially longer. Whatever is taking all of this time happens on the client side. I can watch the Firebug network window and see that once the request happens, it goes pretty quickly. But in the browser, it bogs down and if the size of the tree is big enough, it simply either hangs up the browser and Windows asks me if I want to kill it, or it may time out and do nothing.

    Can someone tell me what's going on here? Is there something I can check for on the client side to cut down on the processing time?


    Here's a code snippet where the grid is created, and the export button is added:
    Code:
            this.surveyGrid = isc.TreeGrid.create({
                width: "100%",
                height: "*",
                showHeader: false,
                showConnectors: true,
                showFullConnectors: true,
                dataSource: this.getDataSource(),
                autoFetchData: true,
                sortField: "DispOrder",
                loadDataOnDemand: false,
                dataArrived: function() {
                    this.getData().openAll();
                },
                wrapCells: true,
                fixedRecordHeights: false,
                fields: [
                    {
                        name: "Name", 
                        title: "Survey Item", 
                        width: "*",
                        formatCellValue: function(value,record) {
                            value = stripHTML(value);
                            if (that.showAnsAttributes && record.AnswerInfo && record.AnswerInfo != "" && record.ItemType == "SA") {
                                value += ' <span class="AI" style="color: #ff0000;">' + record.AnswerInfo + "</span>";
                            }
                            if (record.ItemType == "SQ") {
                                if (that.showAnsAttributes) {
                                    value = value.replace("^|^",' <span class="AI" style="color: #ff0000;">' + record.AnswerInfo + "</span> ");
                                } else {
                                    value = value.replace("^|^","");                                
                                }
                                
                            }
                               return value;
                        }
                    }
                ],
                getIcon: function(node) {
                    return null;
                },
                recordCustomStyleProperty: "ItemType"
            });
            this.exportButton = isc.IButton.create({ 
                autoDraw: false,            
                title:"PDF / Print",  
                click:function () {
                   var settings = {
                       skinName: "Enterprise", 
                       pdfName: "Survey" + "_" + that.surveyDefId // without .pdf
                   };
                   isc.RPCManager.exportContent(that.view, settings);
                }
            });

    #2
    We can take a look at this, but we'll need to see the actual data in the tree so we can reproduce the delay you're seeing.
    Can you modify the above snippet to be runnable as-is? Probably the easiest thing to do is to show us the DataSource definition attached to the tree, and the sample data the tree is actually displaying serialized as XML or JS. That way we can easily drop this into a running environment, import the sample data for the dataSource and run the sample ourselves.

    Thanks
    Isomorphic Software

    Comment


      #3
      Actually - on re-reading this thread, we realize that we misread what you are doing.
      exportContent() (and exportClientData()) work by serializing out HTML on the client side, along with various pieces of styling information, etc, and sending it to the server to convert to an appropriate format (PDF, etc).
      For a large and complex grid this may start to take some time, especially if (as in this sample), you're running custom formatting code on every cell in the grid. We're not sure how many records we're talking about here, but "20 pages of data" sounds pretty significant.

      We wouldn't expect the time to "increase exponentially" with more data, so if you post the information requested above, we will do some sanity checking that nothing is obviously wrong - but unless we encounter a clear bug, we can't guarantee we'll be prioritizing optimizing this path.

      Instead we'd typically recommend using the server-backed "exportData" function to export large and complex trees of data as it is better designed to handle large volumes of results.

      Regards
      Isomorphic Software.

      Comment


        #4
        Unfortunately all the data is proprietary behind a login, and I don't have an easy way to boil it down and share it.

        Originally posted by Isomorphic View Post
        Instead we'd typically recommend using the server-backed "exportData" function to export large and complex trees of data as it is better designed to handle large volumes of results.
        I'm interested in this, but the documentation is not clear on how exportData() actually works. How do you get it to export as a PDF?

        Comment

        Working...
        X