jQuery UI Widgets Forums Grid jqxgrid initial filter in ready request sent two times

This topic contains 1 reply, has 2 voices, and was last updated by  Martin 5 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • sonu

    I have setup the initial filter property in jqxgrid . But when the initial filter call under the ready function in jqxgrid in console the request is sent in two time. i don’t know why this is happening. i want to set the initial filter and i guess it’s related to some binding issue so can you please help me on this.

    var source =
              {name: 'id', type: 'number'},
              {name: 'last_name', type: 'string'},
              {name: 'store', type: 'string'},
              {name: 'item_descriptor', type: 'string'},
              {name: 'repairer_name', type: 'string'},
              {name: 'product_brand', type: 'html'},
              {name: 'is_floor_stock', type: 'bool'},
              {name: 'days', type: 'number'},
              {name: 'created', type: 'date'},
          url: 'http://testapi.localhost.com/cases/search',
          datatype: 'json',
          pagesize: 20,
          type: 'post',
          root: 'Rows',
          cache: false,
          sortcolumn: 'id',
          sortdirection: 'desc',
          data: {
            params: basicFilters,
          filter: function () {
            // update the grid and send a request to the server.
            $('#jqxgrid').jqxGrid('updatebounddata', 'filter')
          sort: function () {
            // update the grid and send a request to the server.
            $('#jqxgrid').jqxGrid('updatebounddata', 'sort')
          beforeprocessing: function (data) {
            if (data != null && data.length > 0) {
              source.totalrecords = data[0].TotalRows
          pager: function (pagenum, pagesize, oldpagenum) {
            $('#jqxgrid').jqxGrid('updatebounddata', 'data')
            // callback called when a page or page size is changed.
      var addfilter = function () {
        var filtergroup = new $.jqx.filter();
        var filter_or_operator = 1;
        var filtervalue = 'In store awaiting dispatch to repairer';
        var filtercondition = 'equal';
        var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
        filtergroup.addfilter(filter_or_operator, filter1);
        $("#jqxgrid").jqxGrid('addfilter', 'repairer_status', filtergroup);
      var dataAdapter = new $.jqx.dataAdapter(source);
          source: dataAdapter,
          altrows: true,
          width: 1106,
          autoheight: true,
          sortable: true,
          filterable: true,
          showfilterrow: true,
          showsortmenuitems: false,
          pageable: true,
          virtualmode: true,
          rendergridrows: function (obj) {
            return obj.data
          ready: function () {
          sorttogglestates: 1,
          autoshowloadelement: false,
          columnsresize: true,
          autorowheight: true,
          columnsheight: 40,
          enablebrowserselection: true,
          columns: [..]

    this is my code when i comment the line $('#jqxgrid').jqxGrid('updatebounddata', 'filter') in source object so the request is working fine and run only once but then in request there is no information is being sent for the initial filter.

    so please help me on this


    Hello imsonujangra,

    Can you, please, check this Example?
    When the grid is loading initially, one request is sent to the server for loading the data and THEN the ready callback is executed where the initial filter is applied, so another request is sent with the filter parameters. (Not both requests are sent from the ready callback)
    This is how jqxGrid server-side filtering works. You can not omit the updatebounddata row in the filter callback, as then the filtering requests would not be sent at all.

    Best Regards,

    jQWidgets Team

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.