Announcement

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

    Nested ListGrid Error inside a DynamicForm

    SmartClient Ajax RIA system
    Version v12.0p_2018-12-18/PowerEdition Deployment (2018-12-18)

    getting the following error when doing nested items in a dynamicForm

    Code:
    Uncaught RangeError: Maximum call stack size exceeded
        at _3.getCriteria (ISC_Grids.js:2957)
        at _3.getCriteria (ISC_Grids.js:2957)
        at _3.getCriteria (ISC_Grids.js:2957)

    here is a test case

    Code:
    isc.ClassFactory.defineClass("GridEditorItem", "CanvasItem");
    
    isc.GridEditorItem.addProperties({
       height:"*", width:"*",
       rowSpan:"*", colSpan:"*",
       endRow:true, startRow:true,
    
       // this is going to be an editable data item
       shouldSaveValue:true,
    
       // Override createCanvas to create the ListGrid with the user can use to set the value.
       createCanvas : function () {
    
           var gridDS = isc.DS.get(this.gridDataSource);
    
           return isc.ListGrid.create({
                autoDraw:false,
                // fill the space the form allocates to the item
                leaveScrollbarGaps:false,
    
                // dataSource and fields to use, provided to a listGridItem as
                // listGridItem.gridDataSource and optional gridFields
                dataSource:gridDS,
                fields:this.gridFields,
                sortField:this.gridSortField,
                groupByField:this.gridGroupByField,
                sortDirection: this.gridSortDirection,
                saveByCell:this.gridSaveByCell,
                editByCell:this.gridEditByCell,
                // the record being edited is assumed to have a set of subrecords
                data:this.getValue(),
                canEdit:this.gridCanEdit,
                editEvent:this.gridEditEvent,
                saveLocally: true, // prevents updates to the datasource
                autoFetchData:false,
                canMultiGroup: true,
                showRecordComponents: true,
                showRecordComponentsByCell: true,
    
                // update form when data changes
                cellChanged : function () {
                    this.canvasItem.saveValue(this.data);
                    if (this.canvasItem.gridSortField != null) {
                        this.sort(this.canvasItem.gridSortField,this.canvasItem.gridSortDirection);
                    }
                },
                //recordDoubleClick: "addItemForm.setData(record);addItemWindow.show();",
                emptyMessage: "<br>"+("nothingSelected")+"</b>",
                createRecordComponent : this.gridRecordComponent,
                cellContextClick: this.gridCellContextClick
    
           });
       },
    
       // implement showValue to update the ListGrid data
       // Note that in this case we care about the underlying data value - an array of records
       showValue : function (displayValue, dataValue) {
           if (this.canvas == null) return;
           this.canvas.setData(dataValue);
       }
    });
    
    isc.RestDataSource.create({
        ID: 'items',
        clientOnly: true,
        fields:[
            { name: "orderkey", primaryKey:true, hidden:true}, 
            { name: "supplierkey" },
            { name: "supplierName", hidden:true},
            { name: "paperCode", title: ('paperCode')},
            { name: "width", title: ('width'), },
            { name: 'comment', title: ('comment')}
        ]
    });
    
    isc.DynamicForm.create({
        ID: "requestForm" 
        ,width:"100%"
        ,height:"100%"
        ,autoDraw:true
        ,useAllDataSourceFields:false
        ,fields: [
            {name:"items",  align:"center", width:"*", height:"*",
                showTitle:false,
                gridCanEdit:false,
                editorType:"GridEditorItem",
                gridDataSource:"iitems",
                gridGroupByField: ["supplierkey", "paperCode" ],
                gridFields:[
                    { name: 'editItemBtn', title:" ",width:25},
                    { name: 'removeItemBtn', title:" ",width:25},
                    { name: "supplierkey",canEdit:false},
                    { name: "paperCode", canEdit:false},
                    { name: "width", showGridSummary:false, showGroupSummary: false ,canEdit:false},
                    { name: 'comment', length:255,canEdit:false}
                ],
                saveLocally: true, // prevents updates to the datasource
                autoFetchData:false,
                startRow:false ,
                endRow:false
            }
    
        ]
    });

    if you remove the gridGroupByField: ["supplierkey", "paperCode" ],
    the error disappears

    #2
    This test case obviously has not been run, as there are syntax errors and other errors.

    Let us know if you have a test case you have actually run.

    Also post the full available stack trace, not just the top few frames. And any Developer Console logs.

    Comment


      #3
      this line repeats at _3.getCriteria (ISC_Grids.js:2957) 13K times so i had to cut the error to be able to fit it in this message

      Code:
      ISC_Core.js:322 Uncaught RangeError: Maximum call stack size exceeded
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.getCriteria (ISC_Grids.js:2957)
          at _3.isc_Canvas_getCriteria [as getCriteria] (ISC_Core.js:4028)
          at _3.<anonymous> (ISC_Grids.js:3100)
          at _3.observation [as ruleContextChanged] (ISC_Core.js:353)
          at _3.isc_Canvas_fireRuleContextChanged [as fireRuleContextChanged] (ISC_Core.js:3607)
          at _3.isc_Canvas_provideRuleContext [as provideRuleContext] (ISC_Core.js:3607)
          at _3.isc_DynamicForm__delayedSetValues [as $9n] (ISC_Forms.js:404)
          at _3.isc_c_Page_handleEvent [as handleEvent] (ISC_Core.js:1831)
          at _3.isc_c_EventHandler__handleIdle [as $jw] (ISC_Core.js:2224)
          at _3.isc_c_Class_fireCallback [as fireCallback] (ISC_Core.js:322)
          at _3.isc_c_Timer__fireTimeout [as $in] (ISC_Core.js:1820)
          at ISC_Core.js:1817
      isc_c_Class_fireCallback @ ISC_Core.js:322
      isc_c_Timer__fireTimeout @ ISC_Core.js:1820
      (anonymous) @ ISC_Core.js:1817
      setTimeout (async)
      isc_c_Timer_setTimeout @ ISC_Core.js:1817
      isc_c_EventHandler_startIdleTimer @ ISC_Core.js:2224
      isc_c_Page_finishedLoading @ ISC_Core.js:1696
      isc_c_Page_handleEvent @ ISC_Core.js:1830
      isc_c_EventHandler_handleLoad @ ISC_Core.js:1860
      load (async)
      isc_c_EventHandler_captureEvents @ ISC_Core.js:2236
      (anonymous) @ ISC_Core.js:2348
      this Code works it just takes a long time for it to come up because the error is recusing

      Code:
      <html>
      <head>
      <link rel="stylesheet" type="text/css" href="rollstock.css">
      <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
      <SCRIPT>window.isc_useSimpleNames = false; var isomorphicDir='../isomorphic/';</SCRIPT>
      <SCRIPT SRC="../isomorphic/system/modules/ISC_Core.js"></script>
      <SCRIPT SRC="../isomorphic/system/modules/ISC_Foundation.js"></script>
      <SCRIPT SRC="../isomorphic/system/modules/ISC_Containers.js"></script>
      <SCRIPT SRC="../isomorphic/system/modules/ISC_Grids.js"></script>
      <SCRIPT SRC="../isomorphic/system/modules/ISC_Forms.js"></script>
      <SCRIPT SRC="../isomorphic/system/modules/ISC_DataBinding.js"></script>
      <SCRIPT SRC="../isomorphic/skins/Enterprise/load_skin.js"></script>
      </head>
      <body>
      
      <script>
      
      isc.ClassFactory.defineClass("GridEditorItem", "CanvasItem");
      
      isc.GridEditorItem.addProperties({
         height:"*", width:"*",
         rowSpan:"*", colSpan:"*",
         endRow:true, startRow:true,
      
         // this is going to be an editable data item
         shouldSaveValue:true,
      
         // Override createCanvas to create the ListGrid with the user can use to set the value.
         createCanvas : function () {
      
             var gridDS = isc.DS.get(this.gridDataSource);
      
             return isc.ListGrid.create({
                  autoDraw:false,
                  // fill the space the form allocates to the item
                  leaveScrollbarGaps:false,
      
                  // dataSource and fields to use, provided to a listGridItem as
                  // listGridItem.gridDataSource and optional gridFields
                  dataSource:gridDS,
                  fields:this.gridFields,
                  sortField:this.gridSortField,
                  groupByField:this.gridGroupByField,
                  sortDirection: this.gridSortDirection,
                  saveByCell:this.gridSaveByCell,
                  editByCell:this.gridEditByCell,
                  // the record being edited is assumed to have a set of subrecords
                  data:this.getValue(),
                  canEdit:this.gridCanEdit,
                  editEvent:this.gridEditEvent,
                  saveLocally: true, // prevents updates to the datasource
                  autoFetchData:false,
                  canMultiGroup: true,
                  showRecordComponents: true,
                  showRecordComponentsByCell: true,
      
                  // update form when data changes
                  cellChanged : function () {
                      this.canvasItem.saveValue(this.data);
                      if (this.canvasItem.gridSortField != null) {
                          this.sort(this.canvasItem.gridSortField,this.canvasItem.gridSortDirection);
                      }
                  },
                  //recordDoubleClick: "addItemForm.setData(record);addItemWindow.show();",
                  emptyMessage: "<br>"+("nothingSelected")+"</b>",
                  createRecordComponent : this.gridRecordComponent,
                  cellContextClick: this.gridCellContextClick
      
             });
         },
      
         // implement showValue to update the ListGrid data
         // Note that in this case we care about the underlying data value - an array of records
         showValue : function (displayValue, dataValue) {
             if (this.canvas == null) return;
             this.canvas.setData(dataValue);
         }
      });
      
      isc.RestDataSource.create({
          ID: 'items',
          clientOnly: true,
          fields:[
              { name: "orderkey", primaryKey:true, hidden:true},
              { name: "supplierkey" },
              { name: "supplierName", hidden:true},
              { name: "paperCode", title: ('paperCode')},
              { name: "width", title: ('width'), },
              { name: 'comment', title: ('comment')}
          ]
      });
      
      isc.DynamicForm.create({
          ID: "requestForm"
          ,width:"100%"
          ,height:"100%"
          ,autoDraw:true
          ,useAllDataSourceFields:false
          ,fields: [
              {name:"items",  align:"center", width:"*", height:"*",
                  showTitle:false,
                  gridCanEdit:false,
                  editorType:"GridEditorItem",
                  gridDataSource:"iitems",
                  gridGroupByField: ["supplierkey", "paperCode" ],
                  gridFields:[
                      { name: 'editItemBtn', title:" ",width:25},
                      { name: 'removeItemBtn', title:" ",width:25},
                      { name: "supplierkey",canEdit:false},
                      { name: "paperCode", canEdit:false},
                      { name: "width", showGridSummary:false, showGroupSummary: false ,canEdit:false},
                      { name: 'comment', length:255,canEdit:false}
                  ],
                  saveLocally: true, // prevents updates to the datasource
                  autoFetchData:false,
                  startRow:false ,
                  endRow:false
              }
      
          ]
      });
      
      </script>
      </body>
      </html>
      Last edited by mabboud; 20 Dec 2018, 11:40.

      Comment


        #4
        The code says gridDataSource:"iitems" instead of "items".

        Comment


          #5
          ok sorry about that
          fixed it and changed it to itemsDS instead this way its different name the the items field


          Code:
          <html>
          <head>
          <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
          <SCRIPT>window.isc_useSimpleNames = false; var isomorphicDir='../isomorphic/';</SCRIPT>
          <SCRIPT SRC="../isomorphic/system/modules/ISC_Core.js"></script>
          <SCRIPT SRC="../isomorphic/system/modules/ISC_Foundation.js"></script>
          <SCRIPT SRC="../isomorphic/system/modules/ISC_Containers.js"></script>
          <SCRIPT SRC="../isomorphic/system/modules/ISC_Grids.js"></script>
          <SCRIPT SRC="../isomorphic/system/modules/ISC_Forms.js"></script>
          <SCRIPT SRC="../isomorphic/system/modules/ISC_DataBinding.js"></script>
          <SCRIPT SRC="../isomorphic/skins/Enterprise/load_skin.js"></script>
          </head>
          <body>
          
          <script>
          
          isc.ClassFactory.defineClass("GridEditorItem", "CanvasItem");
          
          isc.GridEditorItem.addProperties({
             height:"*", width:"*",
             rowSpan:"*", colSpan:"*",
             endRow:true, startRow:true,
          
             // this is going to be an editable data item
             shouldSaveValue:true,
          
             // Override createCanvas to create the ListGrid with the user can use to set the value.
             createCanvas : function () {
          
                 var gridDS = isc.DS.get(this.gridDataSource);
          
                 return isc.ListGrid.create({
                      autoDraw:false,
                      // fill the space the form allocates to the item
                      leaveScrollbarGaps:false,
          
                      // dataSource and fields to use, provided to a listGridItem as
                      // listGridItem.gridDataSource and optional gridFields
                      dataSource:gridDS,
                      fields:this.gridFields,
                      sortField:this.gridSortField,
                      groupByField:this.gridGroupByField,
                      sortDirection: this.gridSortDirection,
                      saveByCell:this.gridSaveByCell,
                      editByCell:this.gridEditByCell,
                      // the record being edited is assumed to have a set of subrecords
                      data:this.getValue(),
                      canEdit:this.gridCanEdit,
                      editEvent:this.gridEditEvent,
                      saveLocally: true, // prevents updates to the datasource
                      autoFetchData:false,
                      canMultiGroup: true,
                      showRecordComponents: true,
                      showRecordComponentsByCell: true,
          
                      // update form when data changes
                      cellChanged : function () {
                          this.canvasItem.saveValue(this.data);
                          if (this.canvasItem.gridSortField != null) {
                              this.sort(this.canvasItem.gridSortField,this.canvasItem.gridSortDirection);
                          }
                      },
                      //recordDoubleClick: "addItemForm.setData(record);addItemWindow.show();",
                      emptyMessage: "<br>"+("nothingSelected")+"</b>",
                      createRecordComponent : this.gridRecordComponent,
                      cellContextClick: this.gridCellContextClick
          
                 });
             },
          
             // implement showValue to update the ListGrid data
             // Note that in this case we care about the underlying data value - an array of records
             showValue : function (displayValue, dataValue) {
                 if (this.canvas == null) return;
                 this.canvas.setData(dataValue);
             }
          });
          
          isc.RestDataSource.create({
              ID: 'itemsDS',
              clientOnly: true,
              fields:[
                  { name: "orderkey", primaryKey:true, hidden:true},
                  { name: "supplierkey" },
                  { name: "supplierName", hidden:true},
                  { name: "paperCode", title: ('paperCode')},
                  { name: "width", title: ('width'), },
                  { name: 'comment', title: ('comment')}
              ]
          });
          
          isc.DynamicForm.create({
              ID: "requestForm"
              ,width:"100%"
              ,height:"100%"
              ,autoDraw:true
              ,useAllDataSourceFields:false
              ,fields: [
                  {name:"items",  align:"center", width:"*", height:"*",
                      showTitle:false,
                      gridCanEdit:false,
                      editorType:"GridEditorItem",
                      gridDataSource:"itemsDS",
                      gridGroupByField: ["supplierkey", "paperCode" ],
                      gridFields:[
                          { name: 'editItemBtn', title:" ",width:25},
                          { name: 'removeItemBtn', title:" ",width:25},
                          { name: "supplierkey",canEdit:false},
                          { name: "paperCode", canEdit:false},
                          { name: "width", showGridSummary:false, showGroupSummary: false ,canEdit:false},
                          { name: 'comment', length:255,canEdit:false}
                      ],
                      saveLocally: true, // prevents updates to the datasource
                      autoFetchData:false,
                      startRow:false ,
                      endRow:false
                  }
          
              ]
          });
          
          </script>
          </body>
          </html>

          Comment


            #6
            any news on this cause it broke some of my screen when i updated from Version v12.0p_2018-04-03/PowerEdition Deployment (2018-04-03) to Version v12.0p_2018-12-18/PowerEdition Deployment (2018-12-18)

            Comment


              #7
              We're looking into it.

              Comment


                #8
                We've fixed the crash back to SC 11.1p, effective of the nightly builds dated 2018-12-22, but please also refer to the docs for ListGrid.setData().

                Comment

                Working...
                X