Results 1 to 4 of 4

Thread: How to send filter values as params to server

  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    43

    Default How to send filter values as params to server

    Hi, Im trying to send filter values to server side to implement remote filtering. I always find null on request.getParameter('name'). Below is the code

    SearchResultStore = new Ext.data.JsonStore({
    id:'SearchResultStore',
    remoteFilter: true,
    autoDestroy: true,
    model: 'ParInfo',
    sorters: [
    {
    property : 'name',
    direction: 'ASC'
    }],

    //pageSize: _itemsPerPage,// items per page
    proxy: {
    type: 'ajax',
    // url: '/wa/app/piservlet',
    url:url.local,
    reader: {
    type: 'json',
    root:'topics',
    totalProperty:'total'
    }
    },pageSize : _itemsPerPage
    });


    //Code to filter the items in extjs
    // configure whether filter query is encoded or not (initially)
    var encode = false;

    // configure whether filtering is performed locally or remotely (initially)
    var local = false;
    var filters = {
    ftype: 'filters',
    // encode and local configuration options defined previously for easier reuse
    encode: encode, // json encode the filter query
    local: local, // defaults to false (remote filtering)

    // Filters are most naturally placed in the column definition, but can also be
    // added here.
    filters: [
    { type: 'string', dataIndex: 'name'},
    { type: 'string', dataIndex: 'opID' },
    { type: 'string', dataIndex: 'city' },
    { type: 'string', dataIndex: 'state' },
    { type: 'string', dataIndex: 'country' }
    ]

    };
    var SearchResultGrid = new Ext.grid.GridPanel({
    title : 'Search Results',
    autoScroll: true,
    autoLoad: false,
    //anchor:'97%',
    //width : 1000,
    //height_gridPanelHeight-20),
    //autoHeight: true,
    region: 'center',
    collapsible: false,
    focusOnToFront:false,
    minSize: 75,
    id:'SearchResultGrid',
    loadMask: true,
    cls:'custom-grid',
    store : SearchResultStore,
    features: [filters],
    columns : [{
    {header:'name',
    dataindex : 'name',
    width : 100
    },
    {header:'ID',
    dataindex : 'ID',
    width : 100
    },
    {header:'country',
    dataindex : 'country',
    width : 100
    },
    {header:'state',
    dataindex : 'state',
    width : 100
    },
    {header:'city',
    dataindex : 'city',
    width : 100
    }]});

    Ext.apply(SearchResultStore.baseParams, {
    name : SearchResultGrid.filters.getFilter('name').getValue()
    });

  2. #2
    Sencha User
    Join Date
    Apr 2011
    Posts
    43

    Default

    I'm using /ux/grid/FiltersFeature.js and /ux/grid/filter/Filter.js

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    43

    Default

    I just found that there is no baseParams in ext 4.0..7 I some how need to send the column filter values as params so that i access it by request.getParameter in the server side. I tried setting encode:true on filter defined above, still dint work. Please some one help.

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    You could have remoteFilter set to true on the store. Any filter done should then send a request...

    Code:
    store.filter('foo', 'bar');
    //request sent
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

Posting Permissions

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