Announcement

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

    Showing wait prompt on tree expand all

    I have a TreeGrid that I want to add "expand all" and "collapse all" buttons to. Depending on the number of nodes in the tree "expand all" may take several seconds or more to complete. So, I want to show a prompt message to the user while it is progress.

    Here is the code for my expandAll method:

    Code:
        expandAll: function () {
        	isc.showPrompt("expanding tree..");
        	setTimeout( function() {
    	    	var tree = workflowAssignmentTree_workflowAssignments.getData();
    	    	var nodes = tree.getAllNodes();
    			for (var i = 0; i < nodes.length; i++) {
    				var node = nodes[i];
    				if (node.id != null) {
    					tree.openFolder(node);
    				}
    			}
    			isc.clearPrompt();
        	}, 1);
        },
    Sometimes this works just fine. However, other times it appears that Smartclient is deferring the actual redrawing of the screen until after my timer function completes. So, the prompt message flashes quickly on the screen but goes away long before the screen is redrawn to show the open folders.

    Is there any way to make this prompt message work properly? Is there call-back I can use for the isc.clearPrompt() call that doesn't get executed until after the screen has actually been repainted?

    I've tried using openFolders() instead of individual calls to openFolder(). I also tried using the callback in openFolder() of the last folder for clearing the prompt. Both of these alternate solutions had the same behavior.

    SmartClient Version: v9.1p_2014-03-10/PowerEdition Deployment (built 2014-03-10)

    Google Chrome Version 36.0.1985.143

    #2
    Isomorphic team: Any thoughts on this issue?

    Comment


      #3
      Any answer on this issue?

      Comment


        #4
        Hello,

        Try this code:
        Code:
            expandAll: function () {
                var treeGrid = workflowAssignmentTree_workflowAssignments;
                isc.showPrompt("expanding tree..");
                // load all data using only one request
                treeGrid.loadDataOnDemand = false;
                // reload currently loaded data
                treeGrid.data = null;
                treeGrid.originalData = null;
                treeGrid.fetchData(null, function (dsResponse, data, dsRequest) {
                    // open all branches
                    treeGrid.getData().openAll();
                    treeGrid.loadDataOnDemand = true;
                    isc.clearPrompt();
                });
            }
        It loads all data using only one request to the server, so it should be much faster.

        Comment

        Working...
        X