1. #51
    Sencha User
    Join Date
    Jul 2010
    Posts
    1
    Vote Rating
    0
    zhangjian420 is on a distinguished road

      0  

    Default tks

    tks


    I am looking for a long time,thank you very much

  2. #52
    Sencha User
    Join Date
    Nov 2013
    Posts
    1
    Vote Rating
    0
    kaushalparik27 is on a distinguished road

      0  

    Default Cannot read property init of null

    Cannot read property init of null


    I am trying to use this plugin in to one of my view js file but i am receiving this error: Cannot read property init of null. I have added ClearButton.js file in my project and added the script reference to main html file. What I am doing wrong here?

  3. #53
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    101
    Vote Rating
    -2
    predator has a little shameless behaviour in the past

      0  

    Default


    Hello,

    I have noticed that after a field is set to read only the clear button is still present.

    Here is my update:
    PHP Code:
            init: function(textField) {
                
    this.textField textField;
                if (!
    textField.rendered) {
                    
    textField.on('afterrender'this.handleAfterRenderthis);
                    
    textField.on('writeablechange'this.handleReadOnlythis);
                }
                else {
                    
    // probably an existing input element transformed to extjs field
                    
    this.handleAfterRender();
                }
            },

    //////

            
    handleReadOnly: function(fieldreadonlyeOpts) {
                var 
    clearButtonEl this.clearButtonEl;
                if (!
    clearButtonEl) {
                    return;
                }


                if(
    readonly) {
                    
    clearButtonEl.destroy();
                } else {
                    
    this.createClearButtonEl(); //'re'-create the button el.
                
    }


            },

    /////

            
    repositionClearButton : function() {
                var 
    clearButtonEl this.clearButtonEl;
                if (!
    clearButtonEl || this.textField.readOnly) {
                    return;
                }
    //            var right = 0;
    //            if (this.fieldHasScrollBar()) {
    //                right += Ext.getScrollBarWidth();
    //            }
    //            if (this.textField.triggerWrap) {
    //                right += this.textField.getTriggerWidth();
    //            }
    //            console.log('RIGHT: '+right);
    //            console.log(-1 * (right + 3));
    //            console.log(right - 22);
               // clearButtonEl.alignTo(this.textField.bodyEl, 'tr-tr', [-1 * (right + 3), 5]);
                
    clearButtonEl.alignTo(this.textField.inputEl'tr-tr', [-56]);
            }, 

  4. #54
    Sencha Premium Member
    Join Date
    Jan 2014
    Posts
    45
    Vote Rating
    1
    valio is on a distinguished road

      0  

    Default


    Quote Originally Posted by aghextjs View Post
    Just quickly checked my code. I'm using it either in vbox or hbox layouts, and primarily within "fieldcontainers" with hbox layouts. I haven't been following the updates in this thread very closely, but in case it is helpful, my version of the plugin is at https://gist.github.com/aghuddleston/5513157. I'm using it w/4.1.1.
    Thanks!

    There's some deprecated stuff in the code
    • replace Ext.getScrollbarWidth() with Ext.getScrollbarSize().width()
    • remove this.textField.addEvents('clear'); [not necessary anymore]
    Why are lines 405-411 commented out?

    Probably we should consider putting up a separate Github repo. It appears to me as if the original devs are not active anymore.

  5. #55
    Ext JS Premium Member
    Join Date
    Mar 2010
    Location
    Northern Virginia
    Posts
    56
    Vote Rating
    4
    aghextjs is on a distinguished road

      1  

    Default


    Quote Originally Posted by valio View Post
    Thanks!

    Why are lines 405-411 commented out?

    See post #25 at http://www.sencha.com/forum/showthre...l=1#post791942. It basically says this:

    Quote Originally Posted by aghextjs View Post
    In addition to PHaroZ changes above for 4.1.0, I commented out the following in updateClearButtonVisibility:

    snip...

    Otherwise, when in Chrome in 18 or Firefox 11, if I moused over a field with no width set and managed by a hbox layout, the field would add extra padding to the right. For a combobox, it would look combo box, clearbutton, whitespace, triggerfield. But, removing above worked for me. I looked at in IE 8, Chrome 18 and Firefox 11. One disclaimer, I only have single line text fields, combo boxes or date fields using the clearbutton.