1. #91
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    219
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default


    @danh2000: will you incorporate my patch from a few days ago?

    Quote Originally Posted by abraxxa View Post
    This is a patch that prevents a store from loading if a valuesQuery without a value is requested:

    change line 1394 to:
    Code:
    if(forceAll === true || (q.length >= this.minChars) || (valuesQuery === true && q )){

  2. #92
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    Quote Originally Posted by abraxxa View Post
    @danh2000: will you incorporate my patch from a few days ago?
    I've been busy with another priority project, so haven't looked into any of the recent requests (sorry!) or debugged any of the issues raised, but at first glance, I don't see why not.

    I can't say exactly when at this stage, but if you add that to an overrides file, I'll announce what's been included in the next build allowing you to remove any overrides that were included/fixed.

    Thanks,

    Dan

  3. #93
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    219
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default


    I did a search on google but couldn't find out what an override file is.

  4. #94
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    Quote Originally Posted by abraxxa View Post
    I did a search on google but couldn't find out what an override file is.
    Rather than patching source files, simply create a file called 'ext-overrides.js' and create overrides for any issues/bugs/requests - document each override and then when you get a new build of Ext or a component, check your overrides file and remove anything that's no longer needed.

    Eg:

    PHP Code:
    Ext.override(Ext.ux.form.SuperBoxSelect, {
        
    //override of doQuery for blah blah blh reason...
        
    doQuery : ...
    }); 
    It's a neater way of incorporating feature requests, bug fixes etc until the next release.

    Update:

    PS. Testing q in that way isn't ideal as a record with a value of 0 would fall through. Additionally a bit of background as to what your value is and what problem you experienced is usually more helpful than just a patch as there may be scenarios that you haven't considered, and my source file is usually not in synch with what you are using.

  5. #95
    Ext User
    Join Date
    Nov 2009
    Location
    China.Shanghai
    Posts
    16
    Vote Rating
    0
    lanhun is on a distinguished road

      0  

    Default


    Writes can search for multiple keywords separated by spaces. Have time to also change the regular expression
    Code:
    doQuery : function(q, forceAll,valuesQuery){
            q = Ext.isEmpty(q) ? '' : q;
            var qe = {
                query: q,
                forceAll: forceAll,
                combo: this,
                cancel:false
            };
            if(this.fireEvent('beforequery', qe)===false || qe.cancel){
                return false;
            }
            q = qe.query;
            forceAll = qe.forceAll;
            if(forceAll === true || (q.length >= this.minChars)){
                if(this.lastQuery !== q){
                    this.lastQuery = q;
                    if(this.mode == 'local'){
                        this.selectedIndex = -1;
                        if(forceAll){
                            this.store.clearFilter();
                        }else{
                            //this.store.filter(this.displayField, q);
                            this.store.filterBy(function(r){
                                var q_data = q.trim().split(' ');
                                if(Ext.isArray(q_data) && q_data.length > 1) {
                                    for(var x in r.data){
                                        var flag = true;
                                        q_data.each(function(q){
                                            if(r.data[x].indexOf(q) == -1) {
                                                flag = false;
                                            }
                                        });
                                        return flag;
                                    }
                                } else {
                                    for(var x in r.data){
                                        if(r.data[x].indexOf(q) != -1) {
                                            return true;
                                        }
                                    } 
                                }
                            });
                        }
                        this.onLoad();
                    }else{
                        
                        this.store.baseParams[this.queryParam] = q;
                        this.store.baseParams[this.queryValuesInidicator] = valuesQuery;
                        this.store.load({
                            params: this.getParams(q)
                        });
                        this.expand();
                    }
                }else{
                    this.selectedIndex = -1;
                    this.onLoad();
                }
            }
        }

  6. #96
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    Quote Originally Posted by lanhun View Post
    Writes can search for multiple keywords separated by spaces. Have time to also change the regular expression
    Sorry, but I didn't follow you - what do you mean by 'writes' and which regular expression are you referring to and what changes?

    I can't blindly incorporate code without seeing test cases and/or understanding use cases for new features.

    I don't mean to sound rude, but a one liner and a block of code isn't very explanatory.

  7. #97
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    219
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default


    Quote Originally Posted by danh2000 View Post
    PS. Testing q in that way isn't ideal as a record with a value of 0 would fall through. Additionally a bit of background as to what your value is and what problem you experienced is usually more helpful than just a patch as there may be scenarios that you haven't considered, and my source file is usually not in synch with what you are using.
    Thanks for the ext-overrides.js hint!

    @valuesquery: I had the problem that an edit form loads its values and each superboxselect triggers a values query although it has no values which slowed down the loading of the form.
    Is there a case there a valuesquery without a value makes sense? I can't think of one.

  8. #98
    Ext User
    Join Date
    Nov 2009
    Location
    China.Shanghai
    Posts
    16
    Vote Rating
    0
    lanhun is on a distinguished road

      0  

    Default


    Quote Originally Posted by danh2000 View Post
    Sorry, but I didn't follow you - what do you mean by 'writes' and which regular expression are you referring to and what changes?

    I can't blindly incorporate code without seeing test cases and/or understanding use cases for new features.

    I don't mean to sound rude, but a one liner and a block of code isn't very explanatory.
    Sorry,My English is poor. That is I use GOOGLE Translation;

    The code can Multi-keyword search with mode: 'local'

    I will work hard to learn English.

  9. #99
    Sencha User
    Join Date
    Sep 2009
    Posts
    29
    Vote Rating
    0
    dusoo is on a distinguished road

      0  

    Default


    @lanhun
    Thanks for your code. Search works for me perfectly now.

  10. #100
    Ext User
    Join Date
    Nov 2009
    Location
    China.Shanghai
    Posts
    16
    Vote Rating
    0
    lanhun is on a distinguished road

      0  

    Default


    Support for multiple keyword search and Highlight multiple keyword.
    Thank you for radtad Code.I revised it. [http://www.extjs.com/forum/showthrea...93#post340193]
    Separated by a space.
    search eg: 'lanhun card'

    Code:
    Ext.override(Ext.ux.form.SuperBoxSelect, {
        caseSensitive: false,
        createValueMatcher: function(value) {
            return new RegExp('('+value.replace(/\s+/g,'|')+')', this.caseSensitive ? 'g' : 'gi');
        },
        prepareData : function(data) {
            var result = Ext.apply({}, data);
            if (Ext.isEmpty(this.getRawValue())) return result;
            result[this.displayField] = data[this.displayField].replace(this.createValueMatcher(this.getRawValue()), '<span class="ext-combo-match">$1</span>');
            return result;
        },
        initList : function() {
                Ext.ux.form.SuperBoxSelect.superclass.initList.apply(this, arguments);
                this.view.prepareData = this.prepareData.createDelegate(this);
        },
        doQuery : function(q, forceAll,valuesQuery){
            q = Ext.isEmpty(q) ? '' : q;
            var qe = {
                query: q,
                forceAll: forceAll,
                combo: this,
                cancel:false
            };
            if(this.fireEvent('beforequery', qe)===false || qe.cancel){
                return false;
            }
            q = qe.query;
            forceAll = qe.forceAll;
            if(forceAll === true || (q.length >= this.minChars)){
                if(this.lastQuery !== q){
                    this.lastQuery = q;
                    if(this.mode == 'local'){
                        this.selectedIndex = -1;
                        if(forceAll){
                            this.store.clearFilter();
                        }else{
                            //this.store.filter(this.displayField, q);
                            this.multiSelectMode = true;
                            this.store.filterBy(function(r){
                                var q_data = q.trim().split(' ');
                                if(Ext.isArray(q_data) && q_data.length > 1) {
                                    for(var x in r.data){
                                        var flag = true;
                                        q_data.each(function(q){
                                            if(r.data[x].indexOf(q) == -1) {
                                                flag = false;
                                            }
                                        });
                                        return flag;
                                    }
                                } else {
                                    for(var x in r.data){
                                        if(r.data[x].indexOf(q) != -1) {
                                            return true;
                                        }
                                    } 
                                }
                            });
                        }
                        this.onLoad();
                    }else{
                        
                        this.store.baseParams[this.queryParam] = q;
                        this.store.baseParams[this.queryValuesInidicator] = valuesQuery;
                        this.store.load({
                            params: this.getParams(q)
                        });
                        this.expand();
                    }
                }else{
                    this.selectedIndex = -1;
                    this.onLoad();
                }
            }
        }
    });

Thread Participants: 95

  1. Animal (3 Posts)
  2. jay@moduscreate.com (1 Post)
  3. Condor (1 Post)
  4. stever (1 Post)
  5. mystix (5 Posts)
  6. MD (1 Post)
  7. JorisA (1 Post)
  8. randomY (1 Post)
  9. DigitalSkyline (1 Post)
  10. sj137 (3 Posts)
  11. boggle (1 Post)
  12. danh2000 (71 Posts)
  13. ostghost (1 Post)
  14. lossendae (1 Post)
  15. ZooKeeper (1 Post)
  16. greco (1 Post)
  17. Fredric Berling (1 Post)
  18. GraemeBryce (2 Posts)
  19. Strati (2 Posts)
  20. syscobra (2 Posts)
  21. boonkerz (4 Posts)
  22. Sesshomurai (3 Posts)
  23. shamansoft (1 Post)
  24. dorgan (2 Posts)
  25. mjhaston (1 Post)
  26. radtad (5 Posts)
  27. Joyfulbob (2 Posts)
  28. crysfel (1 Post)
  29. armandoxxx (2 Posts)
  30. jarlau (1 Post)
  31. lacco (1 Post)
  32. abraxxa (38 Posts)
  33. prometheus (1 Post)
  34. pops (1 Post)
  35. raphac (1 Post)
  36. Scorpie (2 Posts)
  37. supercharge2 (4 Posts)
  38. jmiguel (2 Posts)
  39. ash11tw (2 Posts)
  40. wojan (1 Post)
  41. ryzmen (1 Post)
  42. nmohler (2 Posts)
  43. wki01 (2 Posts)
  44. gacowarlock (1 Post)
  45. kora.kanchan (1 Post)
  46. senacle (3 Posts)
  47. genie_vn (1 Post)
  48. sergey.s (1 Post)
  49. Grolubao (10 Posts)
  50. mathec (1 Post)
  51. jackjia (1 Post)
  52. polydyne (1 Post)
  53. Antjac (1 Post)
  54. Thomas Triplet (1 Post)
  55. Gonfi (1 Post)
  56. kleins (1 Post)
  57. talha06 (1 Post)
  58. scishop (1 Post)
  59. eztam (2 Posts)
  60. frederickd (10 Posts)
  61. dusoo (2 Posts)
  62. iv_ekker (3 Posts)
  63. pym (1 Post)
  64. sudhirhv (3 Posts)
  65. lanhun (14 Posts)
  66. wcasado (1 Post)
  67. ramana_l_v (3 Posts)
  68. cq.yangyu@gmail.com (1 Post)
  69. siberian (1 Post)
  70. Tommi (4 Posts)
  71. rdblyth (2 Posts)
  72. devtig (3 Posts)
  73. markmansour (1 Post)
  74. dhiren.lodhia (1 Post)
  75. slamhan (1 Post)
  76. panter4 (1 Post)
  77. Korbin (2 Posts)
  78. istetska (1 Post)
  79. ian.young (1 Post)
  80. sebterzi (1 Post)
  81. ucoxk (1 Post)
  82. prakashr (1 Post)
  83. danilo.pederiva (1 Post)
  84. --miCZar-- (2 Posts)
  85. zozofoz (1 Post)
  86. spydercavern (1 Post)
  87. tvelykyy (1 Post)
  88. leorossi (3 Posts)
  89. revertTS (1 Post)
  90. joxzaren (1 Post)
  91. leduc (1 Post)
  92. deepthi_r (1 Post)
  93. qiankun (1 Post)
  94. Mr.Solomon (2 Posts)
  95. agony (1 Post)