How do I filter a grid? - Forum - Kendo UI Builder by Progress: OpenEdge Edition - Progress Community
 Forum

How do I filter a grid?

This question is not answered

I found the following code in several places with minor differences:

onShow: function($scope, customData) {
    this.scope = $scope;

    var filter = {
      logic:'and',
      filters: [
          { field: 'somefieldname', operator: 'eq', value: 2}
               ]
    }; 
    this.scope.grid.options.autoBind = false;
    this.scope._$ds.filter(filter);
},

Whatever I try, nothing is working.

All Replies
  • Hi Bert,
     
    When using a view which was created using ‘Blank’ view option in the ‘Add View’ wizard in KUIB designer, we need to append/add specific ‘View Data Source’ name as part of the filter criteria. However, when we use a view which was created using other pre-defined templates (Data Grid, Data Grid Form, Data Grid Separate Form) then inclusion of this data source in filter criteria is optional as the view is always bound to single data source.
     
    I tried following scenarios and it worked fine in both views/screens which was created using ‘blank’ view option and ‘Data Grid’ view option(s).
     
    ‘Blank’ view code snippet: Here ‘myVDS’ is the name of my view data source and ‘CustNum’ is the column/field name.
     
                    onShow: function ($scope, customData) {
                                    this.scope = $scope;
     
                                    var filter = {
                                                    logic: 'and',
                                                    filters: [
                                                                    {
                                                                                    field: 'CustNum',
                                                                                    operator: 'eq',
                                                                                    value: 2
                                                                    }
                                                                       ]
                                    };
                                    this.scope._$ds['myVDS'].filter(filter);
                    },
     
     
     
     
    ‘Data Grid’ view code snippet: Here ‘CustNum’ is the column/field name.
     
    onShow: function ($scope, customData) {
                    this.scope = $scope;
     
                    var filter = {
                                    logic: 'and',
                                    filters: [
                                                    {
                                                                    field: 'CustNum',
                                                                    operator: 'eq',
                                                                    value: 2
                                                    }
                                                       ]
                    };
                    this.scope._$ds.filter(filter);
    }
     
     
    Hope this helps.
     
    Thanks and Regards,
    Anil Kumar.
     
  • Filtering is working now for a DATA GRID too after removing debug code.