Results 1 to 4 of 4

Thread: SearchField Result Broke the Page Number

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    49

    Default SearchField Result Broke the Page Number

    Dear all,

    I use SearchField.js (Ext.ux.form.SearchField) in grid. The result showed up properly, except the page number. For example, the grid has 10 pages. The search result produce 3 pages. But when the next button is clicked to page 4, 5, 6, and so on, there is only blank page.

    Here is the code of SearchField.js:

    Code:
    /*!
     * Ext JS Library 3.2.1
     * Copyright(c) 2006-2010 Ext JS, Inc.
     * [email protected]
     * http://www.extjs.com/license
     */
    Ext.ns('Ext.ux.form');
    
    Ext.ux.form.SearchField = Ext.extend(Ext.form.TwinTriggerField, {
        initComponent : function(){
            Ext.ux.form.SearchField.superclass.initComponent.call(this);
            this.on('specialkey', function(f, e){
                if(e.getKey() == e.ENTER){
                    this.onTrigger2Click();
                }
            }, this);
        },
    
        validationEvent:false,
        validateOnBlur:false,
        trigger1Class:'x-form-clear-trigger',
        trigger2Class:'x-form-search-trigger',
        hideTrigger1:true,
        width:180,
        hasSearch : false,
        paramName : 'query',
    
        onTrigger1Click : function(){
            if(this.hasSearch){
                this.el.dom.value = '';
                var o = {start: 0, limit:20};
                this.store.baseParams = this.store.baseParams || {};
                this.store.baseParams[this.paramName] = '';
                this.store.reload({params:o});            
                this.triggers[0].hide();
                this.hasSearch = false;
            }
        },
    
        onTrigger2Click : function(){
            var v = this.getRawValue();
            if(v.length < 1){
                this.onTrigger1Click();
                return;
            }
            var o = {start: 0, limit:20};
            this.store.baseParams = this.store.baseParams || {};
            this.store.baseParams[this.paramName] = v;
            this.store.reload({params:o});
            this.hasSearch = true;
            this.triggers[0].show();
        }
    });
    How to fix that?

    Thanks in advance.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,451

    Default

    You need to set the page back to zero if it didn't.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    49

    Default setting back to zero

    Thanks, Micthell for your clue.

    But how to set the page back to zero?

    Because on SearchField.js I've define the params for grid page:

    Code:
    this.store.reload({params: o});
    in which o is the variable defined es follow:

    Code:
    var o = {start: 0, limit:3};

    Thank you again.

  4. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    49

    Default [Still Unsolved] Uncorrect Page Number

    I've tried several solutions. Recently, I've changed the code become:

    Code:
    new Ext.ux.form.SearchField({
                    store: applabel_store,
                    width:200,
                    emptyText        : 'Type here ...',
                    params            : {start: 0, limit: 20,pageSize:20}, 
                    afterSearch    : function(){ 
                    grid.store.load()
                        }
    Unfortunately, the problem is still remains.

    How is actually to synchronize search (through Ext.ux.form.SearchField) result and page number (PagingToolbar)?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •