This is a migrated thread and some comments may be shown as answers.

dataSource.filter using angular (external filter)

3 Answers 992 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kake
Top achievements
Rank 1
Kake asked on 03 Jun 2015, 12:41 PM

Hi

 

How access the datasource.filter using angular..

i.e how convert the code below to work in angular.. 

$scope.soneChange = function () {
       var grid = $('#grid').data('kendoGrid');  // Pseudo code..
      var value = $scope.sone;

       if (value) {
           grid.data("kendoGrid").dataSource.filter({ field: "Sone", operator: "eq", value: value });
       } else {
           grid.data("kendoGrid").dataSource.filter({});
       }
   };

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 05 Jun 2015, 06:47 AM
Hi Marius,

You can still access the dataSource and its filters through the Grid widget reference, that in AngularJS context works like this:

http://docs.telerik.com/kendo-ui/AngularJS/introduction#getting-widget-references

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
vignesh
Top achievements
Rank 1
answered on 31 Mar 2016, 03:57 PM

I am trying to integrate the filter(text box) with server side true along with angular grid. 

I have attached part of code as img

Code:(filtering)

<kendo-grid options="mainGridOptions" id="grid" >

$scope.searchGridData = function(curVal){

            var selecteditem = curVal;
            selecteditem.toUpperCase();
            var selectedArray = selecteditem.split(" ");
            if (selecteditem) {
                var orfilter = { logic: "or", filters: [] };
                $.each(selectedArray, function (i, v) {
                    angular.forEach($scope.mainGridOptions.columns, function( key, column ) {
                        angular.forEach(selectedArray, function (i, v1) {
                                orfilter.filters.push({ field: column.field, operator: "contains", value:v1});
                        });
                    });
                });
                console.log(orfilter);    
                //var kgrid = $("#grid").data("kendoGrid");
                //kgrid.dataSource.filter(orfilter);
                $scope.mainGridOptions.dataSource.filter(orfilter);
            }
        };

 

Error: TypeError: $scope.mainGridOptions.dataSource.filter is not a function

 

Thanks in advance

0
Kiril Nikolov
Telerik team
answered on 04 Apr 2016, 06:59 AM
Hello Vignesh,

Would it be possible to open a separate support request with a runnable example where we can reproduce the issue and we will be happy to help.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Kake
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
vignesh
Top achievements
Rank 1
Share this question
or