Success! Looks like we've fixed this one. According to our records the fix was applied for a bug in our system in a recent build.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    DarekKay is on a distinguished road

      0  

    Default New setEnabled(false) issues

    New setEnabled(false) issues


    Besides my reported bug (http://www.sencha.com/forum/showthre...l=1#post695374) which you may have overseen, I found another problem: a disabled TextField is rendered gray, but you can still edit the field itself. Is that a desired behaviour? In my opinion you should not be able to edit a disabled component (it's disabled after all).
    Of course I could add setEditable(false), but I would expect this as a standard behaviour (why would anyone want to disable a component and still be able to edit it).

    Here a simple code:

    Code:
    public void onModuleLoad()
        {
    
            VerticalLayoutContainer cp = new VerticalLayoutContainer();
            TextField textField1 = new TextField();
            textField1.setEnabled(false);
            cp.add(textField1, new VerticalLayoutData(1, -1));
    
            ContentPanel con = new ContentPanel();
            con.setSize("300px", "100px");
            con.add(cp);
            RootLayoutPanel.get().add(con);
        }

  2. #2
    Ext GWT Premium Member
    Join Date
    Jan 2012
    Location
    Linz, Austria
    Posts
    23
    Vote Rating
    1
    FEAT is on a distinguished road

      0  

    Default


    As gishmo pointed out:

    "All form widgets are editable if setEnable(false) ist set. Now you have to use setReadOnly(true) to lock a field. This behavior is different to the GWT standard behavior."

    This solution worked for me

  3. #3
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    239
    Vote Rating
    2
    gishmo is on a distinguished road

      0  

    Default


    yep, but i personally prefer the standard behavior.

  4. #4
    Sencha User
    Join Date
    Oct 2011
    Posts
    54
    Vote Rating
    0
    DarekKay is on a distinguished road

      0  

    Default


    Isn't this exactly the thing you wanted to avoid in GXT 3? GXT 2 had many many things different from the standard GWT behavior (also many method names differed). You obviously found out that it's causing more problems than actually solving them, so GXT 3 appears to me a lot more GWT related - which is great.

    So why a different behavior here? I still can't imagine, why anyone would ever want to disable a field but leave it editable. If you only want to give users the opportunity to give the field a gray style, then "disable" is a really bad description for it, since it doesn't get disabled at all. It would be great, if you'd look into that.

    But nevertheless - thanks for the solution!

  5. #5
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    239
    Vote Rating
    2
    gishmo is on a distinguished road

      0  

    Default


    I agree and for the time without a statement from Sencha I override the ValueBaseField class in the package com.sencha.gxt.widget.core.client.form and created there a method setEnable(enabled) which looks like that:



    @Override
    public void setEnabled(boolean enabled) {
    super.setEnabled(enabled);
    this.setReadOnly(!enabled);
    }

    This works for me.

  6. #6
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    239
    Vote Rating
    2
    gishmo is on a distinguished road

      0  

    Default Update: beta 3

    Update: beta 3


    In beta 3 setEnabled works as it does in beta 2. The read only state is not set. So you have to set the readonly state by hand ...

  7. #7
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
    WesleyMoy is on a distinguished road

      0  

    Default


    Thanks for pointing this out. I've filed a ticket with the team, and I'll update this thread with any changes we plan to make to setEnabled.

  8. #8
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    239
    Vote Rating
    2
    gishmo is on a distinguished road

      0  

    Default


    Works as expected for TextField and TextArea in beta 4!

    But, if you have a disabled ComboBox, the value list is displayed if you click the drop down button.

    Tested with FF 10 and Chrome on OS X.

    Bildschirmfoto 2012-03-02 um 19.06.12 Kopie.jpg

  9. #9
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
    WesleyMoy is on a distinguished road

      0  

    Default


    Thanks for testing this out with beta 4 so soon, and I'm glad to hear that your original problem has been fixed. I'll go ahead and close out the original issue. I'll file a new one for the disabled combo box's trigger showing the drop down menu.

    Issue has been added as EXTGWT-1528.
    Last edited by WesleyMoy; 2 Mar 2012 at 10:57 AM. Reason: Add issue ID.

  10. #10
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    ComboBox bug is now fixed in SVN (rev 2423). Clicking on trigger of disabled combo does not show drop down.