Announcement

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

    Upgrade to 12.1p - this.grid.updateFilterOperators is not a function while grid horizontal scrolling in editor mode

    Hi,

    After upgrade to v12.1p_2020-05-09 I have noticed problem with grid editing.
    If a grid has filterEditor shown and has a lot of columns then if I start editing a row and scroll grid horizontally to show last columns, I got the following js error and consequently those last columns are not rendered (blank space):
    Code:
     
     TypeError: this.grid.updateFilterOperators is not a function Stack from error.stack: 	_3.addItems(<no args: exited>) on [DynamicForm ID:isc_DynamicForm_2] @ ISC_Grids.js:3436:735 	DynamicForm.addItem(<no args: exited>) on [DynamicForm ID:isc_DynamicForm_2] @ ISC_Forms.js:299:276 	GridBody._updateEditItems(<no args: exited>) on [GridBody ID:isc_LG_5_body] @ ISC_Grids.js:749:190 	GridBody.redraw(<no args: exited>) on [GridBody ID:isc_LG_5_body] @ ISC_Grids.js:732:22 	_3.$134b(<no args: exited>) on [GridBody ID:isc_LG_5_body] @ ISC_Grids.js:220:417 	[c]Class.fireCallback(_1=>callback(), _2=>null, _3=>null, _4=>[GridBody ID:isc_LG_5_body], _5=>undef) on [Class Class] @ ISC_Core.js:311:104 	Class._fireActionsOnPause() on [Class Class] @ ISC_Core.js:316:383 	[c]Class.fireCallback(<no args: recursion>)  on [Class Timer] @ ISC_Core.js:311:104 	Timer._fireTimeout(_1=>"$ir516", _2=>536, _3=>undef) on [Class Timer] @ ISC_Core.js:2079:166 	<anonymous>() @ ISC_Core.js:2076:40
    Grid is set as allowFilterOperators = true and showFilterEditor = true.

    Any help?
    MichalG

    #2
    The call "this.grid.updateFilterOperators()" only appears a single time in the entire codebase, so we know where this problem is happening for you - however, we can't reproduce it in our online Showcase and these circumstances should not occur, so we're not sure how your code hit this error.

    Please show your DS and grid config and we can take another look.

    Comment


      #3
      Creating stand-alone test case with datasource and listgrid extracted from our app would take some time.
      Does it help that setting grid.showAllColumns=true eliminates the error?
      MichalG

      Comment


        #4
        We may not need a full test-case for this one, but we need to know more than we have so far - please provide some details:

        1) How many fields are we talking about (DS and grid)?
        2) How much data, roughly?
        3) Are you doing anything complex with field or filter edit-items?
        Last edited by Isomorphic; 19th May 2020, 05:14.

        Comment


          #5
          1. DS has 140 fields, but most of them are set as detail, so listgrid shows 20 columns initially.
          2. DS tested has ~5000 rows, but the problem occurs in other places around app with as much as 100 rows. Paging is set.
          3. Not sure if it is complex, but many of fields are foreign-key comboBoxes or fields with valueXPath set. Also, listGridFields has always editorProperties and filterEditorProperties set.

          Comment


            #6
            Unfortunately, testing with 150 fields, many records and some settings via editorProperties is not showing any problems, with or without showAllColumns set. Most likely there are settings or handlers on the grid or being set via editorProperties that we don't know about.

            So we are going to need a test-case to get to the bottom of it.

            Comment


              #7
              So I have got a test case finally. Just run it and look at the console - "this.grid.updateFilterOperators is not a function" should be there.

              Department.xml:
              Code:
              <response>
                  <status>STATUS_SUCCESS</status>
                  <startRow>0</startRow>
                  <endRow>0</endRow>
                  <totalRows>1</totalRows>
                  <data>
                      <Department>
                          <id>1</id>
                          <code>Oracle</code>
                          <description>Database production</description>
                          <person>
                              <id>11</id>
                              <code>Larry</code>
                              <description>The boss</description>
                          </person>
                      </Department>
                  </data>
              </response>
              Person.xml:
              Code:
              <response>
                  <status>STATUS_SUCCESS</status>
                  <startRow>0</startRow>
                  <endRow>0</endRow>
                  <totalRows>1</totalRows>
                  <data>
                      <Person>
                          <id>11</id>
                          <code>Larry</code>
                          <description>The boss</description>
                      </Person>
                  </data>
              </response>
              Test case:
              Code:
              package pl.com.tech4.client;
              
              import com.google.gwt.core.client.EntryPoint;
              import com.smartgwt.client.data.DataSource;
              import com.smartgwt.client.data.DataSourceField;
              import com.smartgwt.client.data.OperationBinding;
              import com.smartgwt.client.data.Record;
              import com.smartgwt.client.data.fields.DataSourceTextField;
              import com.smartgwt.client.types.AutoFitWidthApproach;
              import com.smartgwt.client.types.DSDataFormat;
              import com.smartgwt.client.types.DSOperationType;
              import com.smartgwt.client.types.DSProtocol;
              import com.smartgwt.client.util.SC;
              import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
              import com.smartgwt.client.widgets.grid.ListGrid;
              import com.smartgwt.client.widgets.grid.ListGridField;
              
              public class MainEntryPoint implements EntryPoint {
              
                  public void onModuleLoad() {
              
                      layout();
                      SC.showConsole();
                  }
              
                  private void layout() {
              
                      DataSource departmentDS = new DataSource();
                      departmentDS.setID("Department");
                      departmentDS.setClientOnly(true);
                      OperationBinding fetchBinding = new OperationBinding();
                      fetchBinding.setOperationType(DSOperationType.FETCH);
                      fetchBinding.setDataFormat(DSDataFormat.XML);
                      fetchBinding.setDataProtocol(DSProtocol.POSTXML);
                      departmentDS.setOperationBindings(fetchBinding);
                      departmentDS.setDataURL("Department.xml");
              
                      DataSource personDS = new DataSource();
                      personDS.setID("Person");
                      personDS.setClientOnly(true);
                      personDS.setOperationBindings(fetchBinding);
                      personDS.setDataURL("Person.xml");
              
                      DataSourceField idField = new DataSourceField();
                      idField.setName("id");
                      idField.setPrimaryKey(true);
                      idField.setHidden(true);
                      DataSourceTextField codeField = new DataSourceTextField();
                      codeField.setName("code");
                      DataSourceTextField descriptionField = new DataSourceTextField();
                      descriptionField.setName("description");
                      personDS.setFields(idField, codeField, descriptionField);
              
                      DataSourceField idDepField = new DataSourceField();
                      idDepField.setName("id");
                      idDepField.setPrimaryKey(true);
                      idDepField.setHidden(true);
                      DataSourceTextField codeDepField = new DataSourceTextField();
                      codeDepField.setName("code");
                      DataSourceTextField descriptionDepField = new DataSourceTextField();
                      descriptionDepField.setName("description");
                      departmentDS.setFields(idDepField, codeDepField, descriptionDepField);
                      DataSourceField[] personField = new DataSourceField[50];
                      DataSourceField[] person_idField = new DataSourceField[50];
                      DataSourceTextField[] person_codeField = new DataSourceTextField[50];
                      DataSourceTextField[] person_descriptionField = new DataSourceTextField[50];
                      for (int i = 0; i < 50; i++) {
                          personField[i] = new DataSourceField();
                          personField[i].setName("person" + i);
                          personField[i].setForeignKey("Person.id");
                          personField[i].setValueXPath("person/id");
                          ComboBoxItem personItem = new ComboBoxItem("person");
                          personItem.setOptionDataSource(personDS);
                          personItem.setValueField("id");
                          personItem.setDisplayField("code");
                          personItem.setPickListFields(new ListGridField("id"), new ListGridField("code"));
                          personField[i].setEditorProperties(personItem);
                          personField[i].setFilterEditorProperties(personItem);
                          departmentDS.addField(personField[i]);
                          person_idField[i] = new DataSourceField();
                          person_idField[i].setName("person"+ i +"_id");
                          person_idField[i].setValueXPath("person/id");
                          departmentDS.addField(person_idField[i]);
                          person_codeField[i] = new DataSourceTextField();
                          person_codeField[i].setName("person"+ i +"_code");
                          person_codeField[i].setValueXPath("person/code");
                          departmentDS.addField(person_codeField[i]);
                          person_descriptionField[i] = new DataSourceTextField();
                          person_descriptionField[i].setName("person"+ i +"_description");
                          person_descriptionField[i].setValueXPath("person/description");
                          departmentDS.addField(person_descriptionField[i]);
                      }
              
                      ListGrid lg = new ListGrid();
                      lg.setDataSource(departmentDS);
                      lg.setShowFilterEditor(true);
                      lg.setAllowFilterOperators(true);
                      lg.setCanEdit(true);
                      lg.setAutoSaveEdits(false);
                      lg.setWidth100();
                      lg.setHeight100();
                      lg.setAutoFitFieldWidths(true);
                      lg.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
                      lg.setAutoFitExpandField("description");
                      lg.setConfirmDiscardEdits(false);
                      lg.setStopOnErrors(true);
                      lg.setModalEditing(false);
                      lg.draw();
                      lg.fetchData();
                      Record dep = new Record();
                      dep.setAttribute("id", 2);
                      lg.startEditingNew(dep);
                      lg.scrollToCell(0, 49);
                  }
              
              }
              MichalG

              Comment


                #8
                Thanks - we'll take a look and get back to you

                Comment

                Working...
                X