Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7630861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:12:26+00:00 2026-05-31T06:12:26+00:00

I’m working with ExtJS4 and trying to build a search feature using a form.

  • 0

I’m working with ExtJS4 and trying to build a search feature using a form. I’ve got the form displayed and a user enters one of 4 criteria and clicks Search, the grid is then built and shows the results from a JSON call.

What I’m trying to achieve is to allow the user to be able to enter different search criteria and click Search again and have the grid updated to show the new results. In my first attempt the grid is rendered for each click of Search and in my second attempt it simply pushes the results of the search into the grid without removing the previous entries.

Here’s my current setup:

Ext.define('job',{
        extend:'Ext.data.Model',
        fields:['account_name', 'account_number','job_number','contract_year','program','type', 'version']
})

Ext.onReady(function(){

    var formPanel = Ext.widget('form', {
        renderTo: 'search',
        frame: true,
        width: 350,
        bodyPadding: 5,
        bodyBorder: false,
        title: 'Search',

        defaults: {
            anchor: '100%'
        },
        {
            xtype: 'combo',
            name: 'jobyear',
            fieldLabel: 'Job Year',
            store:
                new Ext.data.SimpleStore({
                    fields: ['year'],
                    data: [
                        ['2008'],['2009'],['2010'],['2011'],['2012']
                    ] //end of data
            }),
            displayField: 'year',
            typeAhead: true,
            emptyText: 'Select a year'
        }], //end of items

        dockedItems: [{
            xtype: 'container',
            dock: 'bottom',
            layout: {
                type: 'hbox',
                align: 'middle'
            },
            padding: '10 10 5',

            items: [{
                xtype: 'component',
                id: 'formErrorState',
                baseCls: 'form-error-state',
                flex: 1
            }, {
                xtype: 'button',
                formBind: true,
                id: 'search',
                disabled: true,
                text: 'Search',
                width: 140,
                height: 35,
                handler: function() {
                    var columns = [
                     {xtype: 'rownumberer',sortable: true},
                     {text: 'School Name', sortable:true,dataIndex:'account_name'},
                     {text: 'Acct Number', sortable:true,dataIndex:'account_number'},
                     {text: 'Job Number',sortable:true,dataIndex:'job_number'},
                     {text: 'Version',sortable:true,dataIndex:'version'},
                     {text: 'Contract Year',sortable:true,dataIndex:'contract_year'},
                     {text: 'Program', sortable:true,dataIndex:'program'},
                     {text: 'Job Type', sortable:true,dataIndex:'type'}
                    ]; // end columns

                    var userGrid = new Ext.grid.Panel({
                    id: 'FOO',
                    multiSelect:true,
                    store: store,
                    columns: columns,
                    stripeRows: true,
                    title: 'Results',
                    renderTo: Ext.get('results'),
                    dockedItems: [{
                        xtype: 'pagingtoolbar',
                        store: store,
                        dock: 'bottom',
                        displayInfo: true
                    }],
                    })
                  var form = this.up('form').getForm();
                  var store = new Ext.data.Store({
                        model: 'job',
                        pageSize: 10,
                        autoLoad: true,
                        remoteSort:true,
                        proxy: {
                            actionMethods: {
                                read: 'POST'
                            },
                            type: 'ajax',
                            fields: ['job_number', 'account_name', 'account_number', 'contract_year','program','type','version'],
                            url: '/search?'+ form.getValues(true),
                            reader:{
                                type: 'json',
                                root: 'results',
                                totalProperty: 'totalCount'},
                        }, //end proxy
                        sorters:[{
                            property:'version',
                            direction:'ASC'
                        }]
                    }).on('load', function(){
                         userGrid.reconfigure(this); // ??? 
                         });
            } // end button handler
        }] //end items
    }] // end dockeditems

});
});

I’ve tried refreshing the grid and calling load() but I don’t think I’ve hit yet on the right combination. I’d like the grid contents to be replaced with those from the latest ajax call to /search.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:12:27+00:00Added an answer on May 31, 2026 at 6:12 am

    You should not create a new panel and a store on each search button click, so move it out of the button handler. If you just call load({params:{search:’whatever’}}) on the store of the grid when user pushes search button you will get the new data populated in your grid automatically. You don’t need to reconfigure the grid or do anything else. Essentially the grid is bound to the store and when the store data changes the view behind the grid will automatically refresh.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.