Hybrid View

  1. #1
    Ext User
    Join Date
    Apr 2010
    Posts
    4
    Vote Rating
    0
    Mr.Gray is on a distinguished road

      0  

    Default Tri-state checkbox for ExtJs 3.0

    Tri-state checkbox for ExtJs 3.0


    The code is base on great work of Condor and other developers who posted at http://www.extjs.com/forum/showthrea...ht=tricheckbox

    tricheckbox.png
    Attached Files

  2. #2

  3. #3
    Ext User
    Join Date
    Aug 2008
    Posts
    1
    Vote Rating
    0
    waky is on a distinguished road

      0  

    Default


    Thanks!

  4. #4
    Ext User
    Join Date
    Nov 2010
    Location
    Rennes, France
    Posts
    19
    Vote Rating
    0
    xavxav is on a distinguished road

      0  

    Question How to trigger any action ?

    How to trigger any action ?


    Thanks a lot !

    Is it possible to trigger any action when the user clicks on one tri-state checkbox ?

    Regards,
    Xavier

  5. #5
    Ext User
    Join Date
    Nov 2010
    Location
    Rennes, France
    Posts
    19
    Vote Rating
    0
    xavxav is on a distinguished road

      0  

    Lightbulb


    Is it possible like this :
    PHP Code:
    {
        
    xtype'tricheckbox',
        
    name'tri-check2',
        
    fieldLabel'Checked',
        
    checkedtrue,
        
    disabledtrue,
        
    listeners: {
            
    check: function() {
                
    // write your code here
            
    }
         }


  6. #6
    Sencha User
    Join Date
    Jul 2010
    Posts
    4
    Vote Rating
    0
    harry.yoo is on a distinguished road

      0  

    Default


    Thanks, j.bruni for making this. It was working fantastically in ExtJS 3.x

    Do you have any plan to make this work on 4.x?

  7. #7
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    14
    Vote Rating
    1
    masood is on a distinguished road

      0  

    Default Tabbing and Focus

    Tabbing and Focus


    I seem to have an issue where the checkbox never receives focus. I am trying to tab through the form, but it always skips the tri-state checkbox.
    Does anyone else have this issue?

    Thanks

  8. #8
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    claudio476 is on a distinguished road

      0  

    Default Little bug

    Little bug


    I fix little bug: if try to set the initial value at null, the component don't set the right class.

    i just change the follow condition:

    Code:
            if (inputEl) {
                inputEl.dom.setAttribute('aria-checked', me.value == '1' ? true : false);
            }
                me['removeCls'](me.checkedClasses[oldCheck])
                me['addCls'](me.checkedClasses[this.currentCheck]);
            //}
    new setRawValue:

    Code:
    setRawValue: function (v) {
            var me = this;
    
    
            if (v === false) v = '0';
            if (v === true) v = '1';
            if (v == null || v == '' || v === undefined) {
                if (!this.triState)
                    v = '0';
                else v = 'null';
            }
    
    
            var oldCheck = me.currentCheck;
            me.currentCheck = me.getCheckIndex(v);
            me.value = me.rawValue = me.values[me.currentCheck];
    
    
            // Update classes
            var inputEl = me.inputEl;
            if (inputEl) {
                inputEl.dom.setAttribute('aria-checked', me.value == '1' ? true : false);
            }
    
             me['removeCls'](me.checkedClasses[oldCheck])
             me['addCls'](me.checkedClasses[this.currentCheck]);
           
        },
    Regards,
    Claudio.

  9. #9
    Sencha User
    Join Date
    Oct 2007
    Location
    Berlin, Germany
    Posts
    891
    Vote Rating
    9
    wm003 will become famous soon enough

      0  

    Default


    Quote Originally Posted by xavxav View Post
    Is it possible like this :
    PHP Code:
    {
        
    xtype'tricheckbox',
        
    name'tri-check2',
        
    fieldLabel'Checked',
        
    checkedtrue,
        
    disabledtrue,
        
    listeners: {
            
    check: function() {
                
    // write your code here
            
    }
         }

    The check-listener is still possible, but in your example you set the checkbox to "disabled". in that case the check event is not triggered (just like the original checkbox widget)