1. #1
    Ext JS Premium Member mikegiddens's Avatar
    Join Date
    Mar 2007
    Location
    Denver, Colorado
    Posts
    273
    Vote Rating
    1
    mikegiddens will become famous soon enough

      0  

    Question ComboBox and clear / reset issues

    ComboBox and clear / reset issues


    I am so proud of the Ext Team you just don't know. Jack you are the man and Animal and Jeff. Just give me some time to get my skills up and I will be right there with yall

    I almost have a working release for a wonderful showcase piece.

    So here is a bit tougher questions that I have tried to figure out myself but decided to ask the pros.

    First of all I am not using the new Forms class. I have read the code but hoping to see the docs and some examples to get the Ext.form in use.

    I want to address 3 questions based on the attached screenshots.

    1) I am looking to see how to catch the < minChars or empty ComboBox from hitting backspace or delete.

    2) I am looking on how to get the height to get a blank row to be my default to have the same. (Screenshot4)
    I think I already hacked this one by adding a height:12px to "x-combo-list-item"

    3) Reset paging back to 1 when submitting a new request and not a next or back click.

    =============================

    Screenshot 1 show my ComboBoxes on the left and my results on the right. Sample code from one of my combo boxes:
    Code:
    		///////////////////////////////////////////////////////////////////////////
    		// Barcode ComboBox
    		///////////////////////////////////////////////////////////////////////////
        var dataJSON11 = new Ext.data.Store({
            proxy: new Ext.data.HttpProxy({
                url: 'util/lists-json.php'
            }),
            reader: new Ext.data.JsonReader({
                root: 'nodes',
                id: 'name'
            }, [ {name: 'name', mapping: 'name'} ])
        });
    
        var combo11 = new Ext.form.ComboBox({
            store: dataJSON11,
            displayField:'name',
            typeAhead: false,
            hideTrigger:true,
    				minChars:2,
            value:''
        });
    
    		combo11.on("beforequery", function () {dataJSON11.baseParams= {"type":"barcode"}});
    		combo11.on("select",function () { Shell.applySearchFilter();	});
        combo11.applyTo('search-barcode');
    Code:
    						applySearchFilter: function() {
    // Here I need to reset the paging back to page 1 when processing a new set of filters.
    								var form = Ext.get('search-form');
    								GridSpecies.ds.baseParams = {"famclass":form.dom.famclass.value,"family":form.dom.family.value,"genus":form.dom.genus.value,"species":form.dom.species.value,"subspecies":form.dom.subspecies.value,"collector":form.dom.collector.value,"country":form.dom.country.value,"state":form.dom.state.value,"parish":form.dom.parish.value,"placename":form.dom.placename.value,"barcode":form.dom.barcode.value};
    								GridSpecies.ds.proxy.url = "util/species-records-json.php";
    								GridSpecies.ds.reload();
    						}
    Issue 1) Every things works they way I want it to when adding information. What I am looking for is how to add a keylistener that does not interfere with the minChar listener.

    Issue 3) If I am browsing pages greater than 1 on my results and I go to my filters to add more filters to the results and my page was not on 1 I am not sure how to force the rest of the paging. When I added baseparams: start=0 it reset the grid but start was now hardcoded to 0.

    Any insite on these 2 issues perticularly the < then minChar issues. I will even take a if
    something like if keys = backspace or delete and value.length < minChars then value = ''
    I just don't want to hack around at it if there is a built in solution.

    Thanks guys.

    P.S. I am working on a cool widget that I am fine tuning to add to the examples in the next week or so.

  2. #2
    Sencha - Community Support Team JeffHowden's Avatar
    Join Date
    Mar 2007
    Location
    Forest Grove, OR
    Posts
    1,038
    Vote Rating
    1
    JeffHowden is on a distinguished road

      0  

    Default


    Quote Originally Posted by mikegiddens View Post
    I am so proud of the Ext Team you just don't know. Jack you are the man and Animal and Jeff.[...]
    It's an honor to have my name included with Jack and Animal; thanks.

    Quote Originally Posted by mikegiddens View Post
    3) Reset paging back to 1 when submitting a new request and not a next or back click.
    From my paged grid filter post in the examples and extras forum:

    http://www.extjs.com/forum/showthread.php?t=2758

    The important bit is calling the load() method of the store like so:

    Code:
    ds.load({ // call the load() method of your datastore
      params: {
        start: 0 // reset the start to 0 since you want the filtered results to start from the first page
      , limit: 20
      }
    });
    I'm not sure on your other questions as I haven't had opportunity to get as familiar with those classes as I'd like yet.
    Jeff Howden
    Ext JS - Support Team Volunteer
    jeff@extjs.com

    Any and all code samples that are authored by me and posted on the Ext forums or website are hereby released into the public domain and I release anyone or entity of liability by using said code samples unless explicitly stated otherwise.

    Opinions are mine and not necessarily endorsed by Ext, LLC. Please do not contact me directly for assistance unless requested by me.

  3. #3
    Ext JS Premium Member mikegiddens's Avatar
    Join Date
    Mar 2007
    Location
    Denver, Colorado
    Posts
    273
    Vote Rating
    1
    mikegiddens will become famous soon enough

      0  

    Default


    Thanks Jeff. That fixed issue #3. Hopefully Animal has some incite on issue #1.

    Hopefully one day I will be answering questions on how to get stuff to work.

  4. #4
    Ext User
    Join Date
    Apr 2007
    Posts
    43
    Vote Rating
    0
    aclavijo is on a distinguished road

      0  

    Red face


    los ejemplos son perfestos,. Podrias poner elcodio para verlos mejor

  5. #5
    Ext Premium Member phibix's Avatar
    Join Date
    Apr 2007
    Location
    Dallas
    Posts
    20
    Vote Rating
    0
    phibix is on a distinguished road

      0  

    Default


    Mike, this might be of use to you. Functionally it solves #1, allowing you to deselect a combo box's value.

    HTML Code:
    Ext.form.ComboBox.prototype.doForce = function() {
      if(this.el.dom.value.length > 0 && this.el.dom.value != this.emptyText) {
        this.el.dom.value = this.lastSelectionText === undefined ? '' : this.lastSelectionText;
        this.applyEmptyText();
      }
    };
    With this in place an empty combo box will reset to show the emptyText string.

    P

  6. #6
    Ext Premium Member phibix's Avatar
    Join Date
    Apr 2007
    Location
    Dallas
    Posts
    20
    Vote Rating
    0
    phibix is on a distinguished road

      0  

    Default


    Ooo i spoke too soon. I should have tested it further. This allows the empty text to display in the input item, but getValue() still returns the old value. I'll see if i can fix it.

    P

  7. #7
    Ext Premium Member phibix's Avatar
    Join Date
    Apr 2007
    Location
    Dallas
    Posts
    20
    Vote Rating
    0
    phibix is on a distinguished road

      0  

    Default


    This works properly as far as I can tell.

    PHP Code:
    Ext.form.ComboBox.prototype.doForce = function() {
      if(
    this.el.dom.value == this.emptyText) {
        
    this.setValue('');
        
    this.applyEmptyText();
      }
      else if(
    this.el.dom.value.length 0) {
        
    this.el.dom.value this.lastSelectionText === undefined '' this.lastSelectionText;
        
    this.applyEmptyText();
      }