dataSource.filter using angular (external filter)

4 posts, 0 answers
  1. Kake
    Kake avatar
    14 posts
    Member since:
    Jan 2015

    Posted 03 Jun 2015 Link to this post

    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({});
           }
       };

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 05 Jun 2015 Link to this post

    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!
     
  3. vignesh
    vignesh avatar
    1 posts
    Member since:
    Mar 2016

    Posted 31 Mar 2016 in reply to Kiril Nikolov Link to this post

    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

  4. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 04 Apr 2016 Link to this post

    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!
     
Back to Top