Results 1 to 3 of 3

Thread: Search in the JSON Store Grid

  1. #1
    Sencha User
    Join Date
    Jul 2013
    Posts
    18

    Default Search in the JSON Store Grid

    Hi,

    I have grid loading data using JSON store.

    var store = new Ext.data.JsonStore({
    root: 'topics',
    totalProperty: 'totalCount',
    idProperty: 'threadid',
    remoteSort: true,
    //url: 'http://extjs.com/forum/topics-browse-remote.php',
    fields: [
    'title', 'forumtitle', 'forumid', 'username',
    {name: 'replycount', type: 'int'},
    {name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
    'lastposter', 'excerpt'
    ],
    proxy: new Ext.data.HttpProxy({
    url: '/apps/FusionChartConsole'
    })
    });
    store.setDefaultSort('lastpost', 'desc');

    now the store has 25 records as i implemented paging grid. I want to search these 25 records using the fieldname and reload the store only the matching records among 25.

    i just put the below line in search button click event. But it is not working.
    store.reload({params:{username:'testuser'}});

    i stuck in these whole day. Help me out of this..

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    549

    Default

    If you're only wanting to search amongst the currently loaded records, then surely you could just filter the store, rather than reloading it?

    This way you don't need an additional call to the DB.

    http://docs.sencha.com/extjs/3.4.0/#...-method-filter

  3. #3
    Sencha User
    Join Date
    Jul 2013
    Posts
    18

    Default

    This is worked for me.
    grid.getStore().filter('employee', new RegExp("^"+schFiled.getValue()+"$"));

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
  •