Announcement

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

    Tree.getChildren() error with grouped Listgrid

    Hello,

    We saw this error with a recent 8.2 build. Not sure how it happened but it was with a grouped ListGrid. Just passing it on in case there is some easy null check you can add to avoid in the future

    Code:
    14:20:00.153:MMV3:WARN:Log:TypeError: Object 9999999999990999999999999 has no method 'stringify'
        unnamed() @
        unnamed()
        unnamed()
        unnamed()
        Tree.getChildren()
        Class.invokeSuper()
        Class.Super()
        groupTree.createAutoChild.getChildren()
        Tree.getOpenList()
        Tree._getOpenList()
        Tree.getLength()

    #2
    It's not obvious exactly where a preventative null-guard would go for this reported error - we could try putting something in but it would be blind guesswork and we'd rather not take that approach (it might or might not fix the problem but would be very likely to mask a more fundamental issue if it did fix anything).

    It sounds like this was a one-off - if it persists and is reproducible please let us know (and ideally get us a test case!)

    Thanks
    Isomorphic Software

    Comment


      #3
      Instructions to reproduce error

      I ran into the same problem and was able to reproduce the error.

      Run the following code and click the title of "Weight" column to change sorting:
      Code:
      isc.DataSource.create({
      	ID: "testDS",
      	clientOnly: true,
      	fields: [
      		{ primaryKey: true, name: "id", type: "integer", detail: true },
      		{ name: "title", type: "text" },
      		{ name: "weight", type: "integer" }
      	],
      	testData: [
      		{ id: 1, title: "Good", weight: 1 },
      		{ id: 2, title: "Bad", weight: 0 }
      	]
      });
      
      isc.ListGrid.create({
      	ID: "grid", width: "100%", height: "100%", autoFetchData: true,
      	dataSource: testDS,
      	fields: [{ name: "weight" }, { name: "title"}],
      	groupByField: "weight"
      });
      Log messages:

      08:33:31.571:MUP7:WARN:Log:TypeError: Object 9999999999990999999999999 has no method 'stringify'
      unnamed() @
      unnamed()
      unnamed()
      unnamed()
      Tree.getChildren()
      Class.invokeSuper()
      Class.Super()
      groupTree.createAutoChild.getChildren()
      Tree.getOpenList()
      Tree._getOpenList()
      Tree.getLength()

      Javascript console error message:

      Uncaught TypeError: Object 9999999999990999999999999 has no method 'stringify'
      (anonymous function)
      isc_Arra_sortByProperties ISC_Core.js:1083
      isc_Arra_sortByProperty ISC_Core.js:1076
      isc_Tree_getChildren ISC_Grids.js:126
      isc_c_Class_invokeSuper ISC_Core.js:306
      isc_c_Class_Super ISC_Core.js:298
      groupTree.createAutoChild.getChildren ISC_Grids.js:3071
      isc_Tree_getOpenList ISC_Grids.js:200
      isc_Tree__getOpenList ISC_Grids.js:204
      isc_Tree_getLength ISC_Grids.js:209
      isc_ListGrid_getTotalRows ISC_Grids.js:2645
      isc_ListGrid_groupTreeChanged ISC_Grids.js:1263
      (anonymous function)
      isc_Tree_sortByProperty ISC_Grids.js:216
      isc_ListGrid_setSort ISC_Grids.js:3011
      isc_ListGrid_headerClick ISC_Grids.js:2858
      isc_ListGrid__headerClick ISC_Grids.js:2852
      isc.A.headerDefaults.itemClick ISC_Grids.js:1060
      isc.A.buttonDefaults.click ISC_Foundation.js:777
      isc_StatefulCanvas_handleActivate ISC_Foundation.js:325
      isc_StatefulCanvas_handleClick ISC_Foundation.js:327
      isc_c_EventHandler_bubbleEvent ISC_Core.js:1670
      isc_c_EventHandler_handleClick ISC_Core.js:1507
      isc_c_EventHandler__handleMouseUp ISC_Core.js:1494
      isc_c_EventHandler_handleMouseUp ISC_Core.js:1485
      isc_c_EventHandler_dispatch ISC_Core.js:1733
      (anonymous function)

      Windows 7, Google Chrome Version 23.0.1271.95 m
      SmartClient Version: SmartClient Version: v8.2p_2012-05-25/Pro Deployment (built 2012-05-25)

      Comment


        #4
        Hi, I just recreated this problem with a recent 8.3 build and developed a patch. This is sort of opaque code so not sure how proper the patch is but the patch is better than the error because the error forces the user to completely refresh the screen to clear it in our app.

        Stack 1
        Code:
        11:52:03.042:TMR0:WARN:Log:TypeError: Object 9999999999990999999999999 has no method 'stringify'
        Stack from error.stack:
            eval()
            Array.isc_Arra_sortByProperties()
            Array.isc_Arra_setSort()
            Tree.getChildren()
            [a]MathFunction.invokeSuper()
            [a]MathFunction.Super()
            groupTree.createAutoChild.getChildren()
            Tree.getOpenList()
            Tree._getOpenList()
            Tree.getLength()
        Stack 2
        Code:
        11:52:03.132:TMR4:WARN:Log:exception message:
        11:52:03.132:TMR4:WARN:Log:"Object 9999999999990999999999999 has no method 'stringify'"
        11:52:03.133:TMR4:WARN:Log:exception:
        11:52:03.133:TMR4:WARN:Log:{}
        11:52:03.151:TMR4:WARN:Log:e.stack=
        11:52:03.151:TMR4:WARN:Log:"TypeError: Object 9999999999990999999999999 has no method 'stringify'
            at eval (eval at isc_Tree__makeOpenNormalizer (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Grids.js?isc_version=v8.3p_2013-03-25.js:127:23), <anonymous>:16:21)
            at Array.isc_Arra_sortByProperties [as sortByProperties] (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Core.js?isc_version=v8.3p_2013-03-25.js:780:21)
            at Array.isc_Arra_setSort [as setSort] (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Core.js?isc_version=v8.3p_2013-03-25.js:777:13)
            at Object.isc_Tree_getChildren (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Grids.js?isc_version=v8.3p_2013-03-25.js:85:82)
            at Object.isc_c_Class_invokeSuper [as invokeSuper] (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Core.js?isc_version=v8.3p_2013-03-25.js:245:93)
            at Object.isc_c_Class_Super [as Super] (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Core.js?isc_version=v8.3p_2013-03-25.js:238:170)
            at Object.groupTree.createAutoChild.getChildren (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Grids.js?isc_version=v8.3p_2013-03-25.js:2120:545)
            at Object.isc_Tree_getOpenList [as getOpenList] (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Grids.js?isc_version=v8.3p_2013-03-25.js:115:103)
            at Object.isc_Tree__getOpenList [as $27l] (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Grids.js?isc_version=v8.3p_2013-03-25.js:118:107)
            at Object.isc_Tree_getAllItems [as getAllItems] (http://localdev.at.com:8080/dev/isoversion/8.3.3.25.13/isomorphic/system/modules/ISC_Grids.js?isc_version=v8.3p_2013-03-25.js:120:670)"

        Patched code. This is the relevant change I made:

        //4/18/13
        //removed prop reference and just set title equal to large number in this case
        //"title = 999999999999 + prop;\n",
        "title = 999999999999;\n",

        Code:
        	if (window.isc &&  isc.version.startsWith("v8.3")){
        		
        	    isc.Tree.getPrototype().addProperties({
        	    	
        	    	$27n : function () {
        	    	    //    function normalizer(obj, property, destination)
        
        	    	    // create a String that sorts:
        	    	    // - [optionally] according to folderness [based on separateFolders]
        	    	    // - [optionally] according to an arbitrary property [sortProp]
        	    	    // - [optionally] according to title. Title is retrieved via 'getTitle()' when the
        	    	    //   sortProp is set to "title".
        
        	    		isc.Log.logInfo("inside patched _makeOpenNormalizer");
        	    		
        	    	    var property = this.sortProp,
        	    	        sortDirection = this.sortDirection,
        	    	        separateFolders = this.separateFolders != false;
        
        	    	    var script = isc.SB.create();
        	    	    script.append("var __tree__ = ", this.getID(), ";\rvar value = '';");
        	    	    // sanity check - if we've been destroyed and this method is called, bail.
        	    	    script.append("if (__tree__ == null) return;\r");
        	    	    // optionally sort by folder vs file
        	    	    if (separateFolders) {
        	    	        var folderPrefix, leafPrefix;
        	    	        if (this.sortFoldersBeforeLeaves) {
        	    	            folderPrefix = "0:";
        	    	            leafPrefix = "1:";
        	    	        } else {
        	    	            folderPrefix = "1:";
        	    	            leafPrefix = "0:";
        	    	        }
        	    	        script.append("value+=(__tree__.isFolder(obj) ? '" + folderPrefix +
        	    	                                                    "' : '" + leafPrefix + "');");
        	    	    }
        
        	    	    var sortProps = this.$73p;
        	    	    sortProps.removeEmpty();
        
        	    	    if (sortProps && sortProps.length) {
        	    	        for (var i=0; i<sortProps.length; i++) {
        	    	            var innerProp = sortProps[i].property;
        
        	    	            // optionally sort by sortSpecifiers
        	    	            if (innerProp && innerProp != "title") {
        	    	                script.append("var prop = obj['", innerProp, "'];\n",
        
        	    	                    "if (isc.isA.Number(prop)) {\n",
        	    	                        "if (prop > 0) prop = '1' + prop.stringify(12,true);\n",
        	    	                    "else {\n",
        	    	                        "prop = 999999999999 + prop;\n",
        	    	                        "prop = '0' + prop.stringify(12,true);\n",
        	    	                    "}\n",
        	    	                    "} else if (isc.isA.Date(prop)) prop = prop.getTime();\n",
        	    	                    "if (prop != null) value += prop + ':';\n"
        	    	                );
        	    	            }
        	    	        }
        
        	    	        if ((sortProps.length > 1 || (sortProps[0].property != "title")) ) {
        	    	            // sort by title
        	    	            script.append("var title = __tree__.getTitle(obj);\n",
        
        	    	                              "if (isc.isA.Number(title)) {\n",
        	    	                                "if (title > 0) title = '1' + title.stringify(12,true);\n",
        	    	                                "else {\n",
        	    	                                	//4/18/13
        	    	                                	//removed prop reference and just set title equal to large number in this case
        	    	                                	//"title = 999999999999 + prop;\n",
        	    	                                    "title = 999999999999;\n",
        	    	                                    "title = '0' + title.stringify(12,true);\n",
        	    	                                "}\n",
        	    	                              "} else if (isc.isA.Date(title)) title = title.getTime();\n",
        	    	                              "if (title != null) {title = title + ''; value += title.toLowerCase();\n}\n");
        	    	        }
        
        	    	        script.append("return value;");
        	    	    }
        
        	    	    //isc.Log.logWarn("script text: " + script);
        	    	    this.addMethods({$27i : new Function("obj,property", script.toString())});
        	    	}
        
        	    })
        	}

        Comment

        Working...
        X