Announcement

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

    ListGrid.containsFocus() returns true/false depending on Firefox/IE!

    Hi,

    We are currently using SmartGWT build 6.0 dated 31/12/2016.
    In our code, we do certain things based on focus!
    For this, we do a simple check:
    Code:
    addEditorExitHandler(new EditorExitHandler() {
        @Override
        public void onEditorExit(EditorExitEvent editorExitEvent) {
            [B]if (!listGrid.containsFocus()) {[/B]
                new Timer() {
                    @Override
                    public void run() {
                        updateItemOnExit();
                    }
                }.schedule(IntegerConst.SCHDULE_TIME);
            }
        }
    });
    However, when using IE, the above condition (listGrid.containsFocus()) returns false, whereas it returns true for Firefox/Chrome!
    Any reasons why it would behave differently for different browsers?

    #2
    This is quite likely a timing issue. Internet Explorer natively differs from other browsers in when it fires its focus and blur events (which are used to trip the editorExit handler in some cases).
    We will take a look and confirm this, but can you describe what your use case is here? What are you trying to achieve at a high level?
    There may be a more reliable way to approach it.

    Regards
    Isomorphic Software

    EDIT: Just to add to this, in our tests we're consistently seeing containsFocus() returning false for the ListGrid on editor exit.
    It is likely that either our test code differs in some crucial way from yours, or we're testing via a different user interaction (or both).
    If you'd like us to look more closely at what's causing the different behavior in IE, we'll need a way to reproduce your results.

    We'd recommend you show us a complete test case we can run locally, and give us detailed steps to reproduce the issue. The source of one of the showcase editing samples might be a good starting point for a self contained entry-point for a test case, and you could simply add an editor exit handler.
    Last edited by Isomorphic; 3 Jan 2017, 14:22.

    Comment


      #3
      The general idea is: when the user is done typing in text box, and exits it, we perform certain actions, unless the focus was shifted to a ListGrid! (in which case, the action is ignored)

      Sample Code
      Code:
      package com.pankaj.gwt.example.client;
      
      import com.google.gwt.core.client.EntryPoint;
      import com.google.gwt.user.client.Timer;
      import com.smartgwt.client.data.DataSource;
      import com.smartgwt.client.util.SC;
      import com.smartgwt.client.widgets.form.DynamicForm;
      import com.smartgwt.client.widgets.form.fields.TextItem;
      import com.smartgwt.client.widgets.form.fields.events.EditorExitEvent;
      import com.smartgwt.client.widgets.form.fields.events.EditorExitHandler;
      import com.smartgwt.client.widgets.grid.ListGrid;
      import com.smartgwt.client.widgets.layout.VLayout;
      
      public class SampleGWT implements EntryPoint {
          @Override
          public void onModuleLoad() {
      
              VLayout layout = new VLayout(15);
              layout.setHeight100();
              layout.setWidth100();
      
             final ListGrid newGrid = new ListGrid();
              newGrid.setHeight(300);
              DataSource ds = DataSource.get("productRevenue");
              newGrid.setDataSource(ds);
              newGrid.setAutoFetchData(true);
              DynamicForm formItem = new DynamicForm();
              TextItem t1 = new TextItem();
              formItem.setFields( t1);
              layout.addMember(formItem);
              layout.addMember(newGrid);
              layout.draw();
              t1.addEditorExitHandler(new EditorExitHandler() {
                  @Override
                  public void onEditorExit(EditorExitEvent editorExitEvent) {
                      if (![B]newGrid.containsFocus()[/B]) {
                          new Timer() {
                              @Override
                              public void run() {
                                  SC.say("I am Here");
                              }
      
                          }.schedule(200);
                      }
                  }
              });
          }
      }
      In this sample, we are able to reproduce the problem.

      Edit:
      To reproduce the issue:
      1. Type something in the text box
      2. Shift focus to the grid (Click on the grid, any element)
      3. We expect newGrid.containsFocus() to return true, because the focus has now shifted to it.
      Last edited by pankaj.jain; 4 Jan 2017, 08:07.

      Comment


        #4
        Hi
        Just a quick follow up to let you know that we see the problem with your test case and have been looking at how best to resolve it.

        With a bit of luck we should be able to make a framework change this week which will get this working. Either way we'll keep you informed

        Regards
        Isomorphic Software

        Comment


          #5
          We've made a change which should address this issue.
          Please try the next nightly build, dated Jan 6 or above

          Regards
          Isomorphic Software

          Comment


            #6
            Thanks for the fix!
            However, this has only been fixed partially for us.
            We have our Grids that contain checkboxes!

            Code:
            newGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
            Clicking on the grid, works perfectly fine and has same behavior in IE vs Firefox/Chrome.
            The issue is when you click on the checkbox (shifting focus from textitem to checkbox of listgrid)! This is where IE still differs!
            Can you please have a look at it?

            Thanks!

            Comment


              #7
              Any update on this?

              Comment


                #8
                Hi
                This issue should be resolved in the latest nightly build in both the 6.0 and 6.1 branch (Jan 17)
                We're doing some additional behind the scenes cleanup / tweaking which is why we didn't notify you sooner, but things should work for you even with clicking on the selection checkbox element now.

                Regards
                Isomorphic Software

                Comment


                  #9
                  On the first impression, it seems to be working great now.
                  Thanks!

                  Comment

                  Working...
                  X