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
    110
    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
    54
    Vote Rating
    2
    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
    59
    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.

  6. #56
    Sencha User
    Join Date
    Jul 2014
    Posts
    38
    Vote Rating
    2
    josei is on a distinguished road

      0  

    Default ExtJS 5 version?

    ExtJS 5 version?


    Some version is scheduled for extjs5?


    getTriggerWidth() has been deprecated.

    http://docs.sencha.com/extjs/5.0.0/a...etTriggerWidth


    thank you

  7. #57
    Sencha Premium Member lorezyra's Avatar
    Join Date
    Dec 2007
    Location
    Japan -- 日本
    Posts
    636
    Vote Rating
    15
    lorezyra will become famous soon enough lorezyra will become famous soon enough

      0  

    Default


    I've already opened a "Feature Request" for this to be added to ExtJS v5...

    http://www.sencha.com/forum/showthre...05-ClearButton
    Perfection as a goal is a nice idea that can point one in a specific direction. However, since "perfection" is an ever changing (evolving?) and moving target, one must admit that perfection can never be obtained...

    When in doubt, check the d4mn source code!
    ================================================
    And here are my terms...
    1. I don't care if you use my source code. (Known as "Code.")
    2. I don't care if I get any monetary compensation.
    3. I do care to receive credit for Code provided. So, please keep my name in the comments for Code provided.
    4. Code is provided without warranty "AS-IS" and I claim absolutely no warranty nor liability to the quality, security, and run-ability on any platform.
    5. By using Code, you accept all risk inherit with Code regardless if Code has known and yet to be discovered bugs.
    6. You are welcome to change and improve the Code to best meet your needs.
    7. I don't care if you use the Code in a commercial or open-source project.
    8. You are not required to contact me prior to using the Code.
    ================================================
    Simple. Enjoy.

  8. #58
    Sencha User
    Join Date
    Jul 2014
    Posts
    38
    Vote Rating
    2
    josei is on a distinguished road

      0  

    Default


    Ok.

    Thank you

  9. #59
    Sencha Premium Member
    Join Date
    Jan 2014
    Posts
    54
    Vote Rating
    2
    valio is on a distinguished road

      0  

    Default


    You could also just use this version at Github
    https://gist.github.com/valioDOTch/234887371d6dea23f917
    It is ExtJS5 compatible, but not flawless.
    The bug I found is: if the input field is several hundred pixels width, the "x" will not appear at the right position, but more in the middle of the field.

    AFAIR the original plugin devs are not active anymore; don't count on them.
    I want to put more effort into reviving this plugin. Probably on Monday.

  10. #60
    Sencha Premium Member
    Join Date
    Apr 2010
    Posts
    109
    Vote Rating
    8
    ralscha will become famous soon enough

      2  

    Default


    Hi

    With ExtJS5 you could use the new trigger feature
    http://docs.sencha.com/extjs/5.0.0/w...Field_Triggers

    It's certainly not that sophisticated as this plugin but it might do the job for certain use cases.

    Here an example how to implement a clear trigger.
    Code:
    {
       xtype: 'textfield',
       triggers: {
       clear: {
           cls: 'x-form-clear-trigger',
           handler: function(tf) {
              tf.setValue('');
           }
       }
    }
    Although the What's new article does not mention it, but it also works with comboboxes (i guess they are just special textfields). Here an example. This example hides and shows the clear trigger depending if the user selected a value or not.

    Code:
    {
      xtype: 'combobox',
      ....               
      listeners: {
       change: function(cb, newValue) {
         if (!Ext.isEmpty(newValue)) {
          cb.getTrigger('clear').show();
         } else {
          cb.getTrigger('clear').hide();
         }
       }
      },
      triggers: {
        clear: {
           cls: 'x-form-clear-trigger',
           weight: -1,    // place clear trigger icon on the left side of the combobox arrow trigger
           hidden: true,
           handler: function(cb) {
              cb.clearValue();
           }
        }
      }
    }
    Ralph