Announcement

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

    ListGrid Cell Context Handler Not Fired in Chrome After Grid Obscured by SelectItem

    This problem occurs in Chrome (41.0.2272.101 m), but Firefox and IE (recent versions) appear OK.

    In a TabSet, I right-justify a SelectItem using TabSet.setTabBarControls(...). The TabSet contains a Tab with a ListGrid. That ListGrid has a cell context handler (via addCellContextClickHandler). The handler shows a context menu.

    The handler fires OK (to have menu shown) upon a context-click (right mouse click in Windows) until the SelectItem dropdown is deployed & then collapsed. After that, the rectangular region of the grid that was covered by the SelectItem dropdown window, when context-clicked within, will not cause the cell context click handler to fire. A context-click on the grid region never covered by the dropdown window still causes the handler to fire.

    This same behavior occurs using a ListGrid immediately below a ToolStripButton having a SelectItem.

    The attached example source demonstrates the behavior.

    SmartClient Version: v9.1p_2014-06-11/PowerEdition Deployment

    Chrome: Version 41.0.2272.101 m
    Attached Files

    #2
    This looks like a bug fixed quite a while ago. Please try a more recent patched build.

    Comment


      #3
      Thanks.

      Rather than to a patched build I upgraded from [v9.1p_2014-06-11/PowerEdition Deployment] to [v10.0p_2015-04-01/PowerEdition Deployment].

      This solved the issue, but caused another elsewhere in our application. The issue is now with DataSourceField.getMultiple(), which throws an exception when used in an if statement.
      Code:
      public class IpStockTake implements EntryPoint {
         public void onModuleLoad() {
            VLayout   vLo = new VLayout();
            IButton   btn = new IButton("Try");
            
            btn.addClickHandler(new ClickHandler() {   
               @Override
               public void onClick(ClickEvent event) {
                  DataSource   ds = getDs();
                  
                  for (String sFld : ds.getFieldNames()) {
                     if (ds.getField(sFld).getMultiple())
                        GWT.log("getMultiple TRUE");
                     else
                        GWT.log("getMultiple FALSE");
                  }
               }
            });
      
            vLo.setMembers(btn);
            vLo.draw();
         }
      
         public DataSource getDs() {
            final DataSourceField[]   aDsf = new DataSourceField[] {
               new DataSourceTextField("Fld1", "Field 1"){{setPrimaryKey(true);}}, 
               new DataSourceTextField("Fld2", "Field 2")
            };
            
            return new DataSource(){{setID("ID"); setClientOnly(true); 
                                     setFields(aDsf);}};
         }
      }
      Stack trace:
      17:55:29.438:MUP3:WARN:Log:com.google.gwt.core.client.JavaScriptException: (TypeError)
      __gwt$exception: <skipped>: Cannot read property 'value_0' of null
      at $booleanValue(ipstocktake-0.js@21:22677)
      at onClick(ipstocktake-0.js@32:5089)
      at $dispatch(ipstocktake-0.js@11:18833)
      at dispatch_0(ipstocktake-0.js@40:18848)
      at dispatch(ipstocktake-0.js@8:1417)
      at dispatchEvent_0(ipstocktake-0.js@11:1540)
      at $doFire(ipstocktake-0.js@9:1592)
      at $fireEvent_0(ipstocktake-0.js@3:1635)
      at $fireEvent(ipstocktake-0.js@29:1491)
      at $fireEvent_1(ipstocktake-0.js@66:4857)
      at fireEvent_0(ipstocktake-0.js@3:4872)
      at anonymous(ipstocktake-0.js@11:10504)
      at apply_0(ipstocktake-0.js@23:471)
      at entry0(ipstocktake-0.js@16:532)
      at anonymous(ipstocktake-0.js@14:514)
      at obj.click(ipstocktake-0.js@17:10528)
      at isc_StatefulCanvas_handleActivate(http://localhost:8080/stocktake/ipstocktake/sc/modules/ISC_Foundation.js@108:229)
      at isc_StatefulCanvas_handleClick(http://localhost:8080/stocktake/ipstocktake/sc/modules/ISC_Foundation.js@13:230)
      at isc_c_EventHandler_bubbleEvent(http://localhost:8080/stocktake/ipstocktake/sc/modules/ISC_Core.js@89:1568)
      at isc_c_EventHandler_handleClick(http://localhost:8080/stocktake/ipstocktake/sc/modules/ISC_Core.js@50:1429)
      at isc_c_EventHandler__handleMouseUp(http://localhost:8080/stocktake/ipstocktake/sc/modules/ISC_Core.js@11:1414)
      at isc_c_EventHandler_handleMouseUp(http://localhost:8080/stocktake/ipstocktake/sc/modules/ISC_Core.js@57:1405)
      at isc_c_EventHandler_dispatch(http://localhost:8080/stocktake/ipstocktake/sc/modules/ISC_Core.js@108:1643)
      at eval(eval at isc__makeFunction (http://localhost:8080/stocktake/ipstocktake/sc/modules/ISC_Core.js@122:77)

      The code above is sample only but our production code has a legitimate use for getMultiple(). Replacing getMultiple() with other DataSourceField boolean methods, e.g., getCanEdit(), getCanSave(), etc., also cause an exception. This definitely does not happen in [v9.1p_2014-06-11/PowerEdition Deployment].

      SmartClient Version: v10.0p_2015-04-01/PowerEdition Deployment

      Chrome: Version 41.0.2272.101 m

      Comment


        #4
        Hi,
        It looks like we're returning a null rather than a boolean false in the case where the property is unset (rather than explicitly false) on the definition.
        Modifying your code to account for that like this:
        Code:
        	            	Boolean multiple = ds.getField(sFld).getMultiple();
        	            	if (multiple == null) multiple = false;
        	            	if (multiple) {
                                    ...
        will get you working for now. We'll look at this case though - while in some cases it is appropriate to distinguish between null and false, this seems like it is not such a case.
        We'll follow up with more information when we have it

        Regards
        Isomorphic Software

        Comment


          #5
          OK, thanks.

          DataSourceField.getRequired(), through working with 2014/06 build, is now throwing this same exception from an if statement. Since getRequired() is more pervasive in our code, rather than provide several code-tweaks (null-checks) to eventually remove, I will try to wait for your changes.

          Comment


            #6
            We've modified DataSourceField getMultiple() and getRequired() in SGWT 5.0p and newer so that they don't ever return null. The fix should be present in the nightly builds marked 2015-04-06 and newer.

            Comment


              #7
              Thanks once again.

              After much testing, I've run across three more issues concerning defaults handling having changed between [v9.1p_2014-06-11/PowerEdition Deployment] and (now) [v10.0p_2015-04-06/PowerEdition Deployment].

              (1) Defaults for ListGrid header columns.

              For a DB2 table DataSource's ds.xml <field> having no "title" attribute, when a ListGrid uses this DataSource and such non-titled field, in [v10.0p_2015-04-06/PowerEdition Deployment] the ListGrid column header is blank whereas in [v9.1p_2014-06-11/PowerEdition Deployment] the header is titled with the <field>'s "name" attribute. It's an issue because our code omits the "title" ds.xml attribute in many cases and relies on "name" for the ListGrid header. See attachment (GridTitles.png).

              Code:
              <DataSource ID="ReplenishmentSubstitute" dataFormat="iscServer" 
                          serverType="sql" dbName="as400" sparseUpdates="true" 
                          tableName="IPBSSUB"   title="Substitute">
                 <fields>
                    <field name="sequence" nativeName="BSEQ" title="Sequence" 
                           type="integer" length="3"/>
                    <field name="itemClass" nativeName="BCLS" type="integer" 
                           length="4"/>
                    <field name="itemVendor" nativeName="BVEN" title="Vendor" 
                           type="integer" length="6"/>
                 </fields>
              </DataSource>
              Code:
              public class ReplenishmentSubstitutesEditor extends Canvas {
                 public ReplenishmentSubstitutesEditor() {
                    final IButton    btn = new IButton("Refresh");
                    final ListGrid   grid = new ListGrid(){{
                       setDataSource(DataSource.get("ReplenishmentSubstitute"));
                       setAutoFitFieldWidths(true);
                       setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);}};
                    VLayout vLo = new VLayout(){{
                       setWidth(250); setHeight(100); setMembers(btn, grid);}};
              
                    addChild(vLo);
                    
                    btn.addClickHandler(new ClickHandler() {
                       @Override
                       public void onClick(ClickEvent event) {
                          grid.fetchData();
                       }
                    });
                 }
              }
              (2) Defaults for ListGridField.getCanEdit() and FormItem.getCanEdit().

              Between [v9.1p_2014-06-11/PowerEdition Deployment] and [v10.0p_2015-04-06/PowerEdition Deployment] the default for getCanEdit() for FormItem subclasses (e.g., SelectItem) and ListGridField went respectively from false to null. It's an issue because our code heavily relies on a non-null value for FormItem.getCanEdit() and ListGridField.getCanEdit() in if statements. (An exception plus the same type of stack trace as in the "2nd Apr 2015, 18:49" posting of this thread result from such usage.)

              Interestingly, the default for DataSourceField.getCanEdit() in both versions is null. It would be OK/preferable (to us) if you made its default false if you thought best to keep the DataSourceField and ListGridField getCanEdit() defaults the same.

              (3) Defaults for "strict mode".

              The default for "strict mode" went from "false" to "true" between the two SmartClient versions. Sans changes to server.properties, with [v10.0p_2015-04-06/PowerEdition Deployment] our server logs became filled with the following type of logging.

              === 2015-04-12 10:24:03,808 [na]]] WARN Validation - attribute 'labelAsTitle' is not declared in Component Schema '{DataSourceField.ds.xml}' and strict mode is enabled. See 'Strict Mode' overview in the documentation for details.DataSource.fields.DataSourceField /DataSource[@ID=IPEnvironment]/fields/5/field[@name=offline]

              Adding "schema.strict.all:false" to server.properties prevents this, but adding that setting was unnecessary with [v9.1p_2014-06-11/PowerEdition Deployment] to not have the extra warnings logged. At https://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/docs/StrictMode.html, the following allusions make it seem the default should really be false (else why would a setting ever be changed to true?).

              In server.properties, strict mode can be turned on or off system-wide for specific schema or specific attributes of schema. Examples:

              # set the global default for *all* Component XML and DataSources
              schema.strict.all:true

              # enable strict checking for any <DataSource> tag
              schema.strict.DataSource:true

              # enable strict checking for DataSource.operationBindings, but not for
              # <OperationBinding> in general (it can appear in other contexts)
              schema.strict.DataSource.operationBindings:true

              Don
              Attached Files

              Comment


                #8
                1) we're not seeing this behavior and there's been no behavior change here. Please try testing in a truly standalone environment, we suspect you have more code involved than you've shown

                2) Returning null is accurate here as the default setting really is null, which per docs causes other settings to take effect. This means that if your code was trying to check for whether a FormItem is editable, it would actually be wrong - it was really checking for whether that particular FormItem is set to be editable or not, which means it would be incorrect if, for example, dynamicForm.canEdit was set to false but formItem.canEdit was unset (null). So we recommend correcting your code here; what we'll do is add a note to the docs about this possible error.

                3) we're not clear on the complaint here. We've added a new feature and it's on by default, and we've provided instructions on how to turn it off if you don't want this kind of validation done. That's a very normal occurrence, so what seems to be the issue?

                Comment


                  #9
                  Thanks, points taken.

                  Our staff found another issue: When a DateItem using a fiscal calendar has its calendar picker clicked, a stack trace is emitted and the calendar is hidden behind the foreground window.
                  Code:
                  public class IpStockTake implements EntryPoint {
                     public void onModuleLoad() {
                        VLayout       vLo = new VLayout();
                        IButton       btn = new IButton("Try");
                        final Window  win = new Window(){{setWidth(300); setHeight(100);}};
                        DynamicForm   frm = new DynamicForm(){{setWidth(300); setHeight(100);}};
                        DateItem      di = new DateItem("Date"){{setUseTextField(true);}};
                        FiscalYear[]  fiscalYears = new FiscalYear[]
                           {new FiscalYear(2010, 0, 4), new FiscalYear(2011, 0, 3),
                            new FiscalYear(2012, 0, 2), new FiscalYear(2012, 11, 31),
                            new FiscalYear(2013, 11, 30), new FiscalYear(2014, 11, 30) 
                           };   
                        int          lastYear = fiscalYears.length-1;   
                        FiscalCalendar   fiscalCalendar = new FiscalCalendar(
                              fiscalYears[lastYear].getMonth(), fiscalYears[lastYear].getDate());
                        
                        fiscalCalendar.setFiscalYears(fiscalYears);
                        fiscalCalendar.setDefaultYearMode(FiscalYearMode.END);
                        DateUtil.setFiscalCalendar(fiscalCalendar);
                        DateUtil.setShowChooserFiscalYearPickers(true);
                        DateUtil.setShowChooserWeekPickers(true);
                        frm.setFields(di);
                        win.addItem(frm);
                        vLo.setMembers(btn);
                        vLo.draw();
                        
                        btn.addClickHandler(new ClickHandler() {
                           @Override
                           public void onClick(ClickEvent event) {
                              win.show();
                           }
                        });
                     }
                  }
                  Stack trace when calendar icon clicked:
                  14:32:34.031:MUP2:WARN:Log:TypeError: Cannot read property 'toLowerCase' of undefined
                  Stack from error.stack:
                  [c]DateUtil.getStartOf(<no args: exited>) @ ISC_Core.js:859:10
                  Function.getFiscalYearObjectForDate(<no args: exited>) @ ISC_Core.js:796:73
                  Function.getFiscalYear(<no args: exited>) @ ISC_Core.js:803:82
                  DateChooser.updateGridData(<no args: exited>) on [DateChooser ID:isc_DateChooser_0] @ ISC_Forms.js:113:796
                  DateChooser.updateUI(<no args: exited>) on [DateChooser ID:isc_DateChooser_0] @ ISC_Forms.js:124:6
                  DateChooser.setData(<no args: exited>) on [DateChooser ID:isc_DateChooser_0] @ ISC_Forms.js:113:245
                  DateItem.showPicker(<no args: exited>) on [DateItem ID:isc_IpStockTake_3_1 name:Date] @ ISC_Forms.js:833:138
                  [a][c]Class.invokeSuper(<no args: exited>) on [DateItem ID:isc_IpStockTake_3_1 name:Date] @ ISC_Core.js:282:93
                  [a][c]Class.Super(<no args: exited>) on [DateItem ID:isc_IpStockTake_3_1 name:Date] @ ISC_Core.js:274:170
                  DateItem.showPicker(<no args: exited>) on [DateItem ID:isc_IpStockTake_3_1 name:Date] @ ISC_Forms.js:1977:429

                  Also see screenshot.

                  SmartClient Version: v10.0p_2015-04-01/PowerEdition Deployment
                  Chrome: Version 41.0.2272.101 m
                  Attached Files

                  Comment


                    #10
                    Has this been verified?

                    Comment


                      #11
                      There are 2 issues here
                      One is a framework issue which we've addressed, so please re-test with the next nightly build (April 25 or above, 5.0 or 5.1 branch).
                      However you'll also need to tweak your code to include explicit actual "FiscalYear" year values for your FiscalYear objects within your sample code.
                      A change like this should suffice:

                      Code:
                      FiscalYear[]  fiscalYears = new FiscalYear[]
                      	         {new FiscalYear(2010, 2010, 0, 4), new FiscalYear(2011, 2011, 0, 3),
                      	          new FiscalYear(2012, 2012, 0, 2), new FiscalYear(2013, 2012, 11, 31),
                      	          new FiscalYear(2014, 2013, 11, 30), new FiscalYear(2015, 2014, 11, 30) 
                      	         };
                      Please let us know if these don't get things working for you.

                      Regards
                      Isomorphic Software

                      Comment


                        #12
                        Your fix and suggestion worked. If I run into other issues, I'll open a new thread. Thanks so much.

                        Comment

                        Working...
                        X