Announcement

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

    Bug? ListGrid's record components are unnecessary destroyed in 12.0

    Hi,

    isc.version == "v12.0p_2018-07-07/LGPL Deployment";

    I have a ListGrid with:
    showRecordComponents: true,
    showRecordComponentsByCell: true,
    recordComponentPoolingMode: "recycle"

    Record components are created for particular column to work as always visible advanced editor (for some reason I could not use custom editor when I was implementing that - probably to have better control over icons) - they are simple DynamicForms editing the record over which they are drawn.
    In 11.1 everything works ok, but in 12.0 components are destroyed as new verison of record is returned from the server..
    By setting component.dontAutoDestroy = true I was able to stop components from being destroyed, but they are cleared anyway, so the result is similar - components are hidden for every row edited.

    Best regards,
    Janusz

    #2
    What you describe shouldn't be happening in "recycle" mode - that sounds like "viewport" mode. However, we have automated cases that seem to show "recycle" mode working as expected. Can you show a test case that would allow this problem to be reproduced?

    Comment


      #3
      Polling mode is not important here. Even in "viewport" component could be destroyed and new instance created for new version of record. (It is "recycle" for sure as updateRecordComponent is being called normally for every reused component.)

      Change record using a button below grid and see form-component from column "capital" disappear (at least in Chrome 67.0.3396.99 on Mac)


      Code:
      isc.ListGrid.create({
          ID: "countryList",
          width:500, height:224, alternateRecordStyles:true,
          dataSource: worldDS,
          // display a subset of fields from the datasource
          fields:[
              {name:"countryCode"},
              {name:"countryName"},
              {name:"capital"},
              {name:"continent"}
          ],
          sortField: 1, // sort by countryName
          dataPageSize: 50,
          autoFetchData: true,
          selectionType: "single",
      
          showRecordComponents: true,
          showRecordComponentsByCell: true,
          recordComponentPoolingMode: "recycle",
          showRecordComponent: function(record, colNum) {
            if(this.getFieldName(colNum) == 'capital') {
          return true; 
            }
            return false;
          },
          recordComponentHeight: 20,
      
          componentDefaults: {
            _constructor: isc.DynamicForm,
            width: "100%",
            implicitSave: false,
            implicitSaveDelay: 800,
            numCols: 1,
            titleOrientation: "top",
            cellPadding: 0,
      
            backgroundColor: "white", // wymuszamy białe tło
      
            fields: [
          {
            name: "capital",
            width: "100%",
            showTitle: false,
            editorType: "TextItem",
            cellStyle: ""
          },
            ],
          },
      
         createRecordComponent: function(record, colNum) {
            if(this.getFieldName(colNum) == 'capital') {
          var formProperties = {
            dataSource: this.getDataSource(),
          };
          var form = this.createAutoChild('component', formProperties);    
          form.editRecord(record);
          //form.grid = this;
          return form;
            }
          },
      
          updateRecordComponent: function(record, colNum, component, recordChanged) {
            //console.log('updateRecordComponent');
            //console.log('component', component);
            //console.log('recordChanged', recordChanged);
            if(this.getFieldName(colNum) == 'capital') {
          //console.log(component.getID());
          component.editRecord(record);
          return component;
            }
            return null;
          },
      
      
      
      })
      
      
      isc.IButton.create({
          left:0, top:240, width:150,
          title:"Continent > Europe",
          click: function () {
              if (!countryList.getSelectedRecord()) return; // nothing selected
              var updatedRecord = isc.addProperties(
                  countryList.getSelectedRecord(),
                  {continent:"Europe"}
              );        
              countryList.updateData(updatedRecord);
          }
      })
      
      isc.IButton.create({
          left:170, top:240, width:150,
          title:"Continent > Asia",
          click: function () {
              if (!countryList.getSelectedRecord()) return; // nothing selected
              var updatedRecord = isc.addProperties(
                  countryList.getSelectedRecord(),
                  {continent:"Asia"}
              );        
              countryList.updateData(updatedRecord);
          }
      })

      Comment


        #4
        This one's been fixed for builds dated July 11 and later - internal references weren't being correctly remapped to the updated record

        Comment


          #5
          Hi,

          Still does not work (as of "v12.0p_2018-07-11/LGPL Deployment") when ListGrid is grouped.

          Best regards,
          Janusz

          Comment


            #6
            We just retested in a grouped grid and see no problems with components being recreated.

            For clarity, we used your exact code, without any settings for dontAutoDestroy, and added canGroupBy: true.

            However, we do see that if we group by Continent and then change a record with your buttons, grouping becomes stale - ie, the record doesn't move groups when it's Continent changes.

            This is due to an issue in your code - your two button methods need to pass {} as the first param in their calls to isc.addProperties(), to ensure they're working with copies of the underlying record.
            Last edited by Isomorphic; 12 Jul 2018, 23:18.

            Comment


              #7
              There must be something more than grouping then.

              I have tried now with my code from the first post and it works grouped, but in my more complex code it does not.
              It works fine ungrouped after you have made a change.

              BTW. button code from the test case is a copy from one of the examples - grid databound update. :)
              I have just added the part for record components.

              Comment


                #8
                Ah - we'll investigate that sample code.

                It's a grouping-only problem - directly updating the live record before save means that downstream code doesn't recognise the change to the group-value and doesn't cause a grouping update.

                If your real code works with a live record like the sample code does, the next step is to make sure it uses a copy instead.

                If that doesn't fix your issue, we'll probably need to see your grid config and/or a deeper example that shows the problem.
                Last edited by Isomorphic; 13 Jul 2018, 01:12.

                Comment

                Working...
                X