Telerik Forums
Kendo UI for jQuery Forum
1 answer
79 views
Hello, I need to make a feature in my grid where the FILTERS of each column are UPDATED according to the result of the GRID.

Attached is an image of an example.

1 - I apply the first filter which brings me only two records of FEMALE users.

2 - When clicking on the GENDER column, it shows two filters (Female and Male) but the result of the first filter brought me only FEMALE user, the filter should show only FEMALE according to the grid result


Can anyone help me with this solution?
Georgi Denchev
Telerik team
 answered on 09 May 2022
0 answers
61 views

We are facing filter issue on Kendo Grid when filter value is mapped to 0, below is the piece of code.

(We are applying existing filters to the new datasource to get the expected result)

Code:

BulkTaggingDataSource.read().then(function () {
  var filter = {};
  if ($("#FoodGrid").data("kendoGrid").dataSource.filter()) {
       filter.filter = $("#FoodGrid").data("kendoGrid").dataSource.filter();
  }

var query = kendo.data.Query.process(BulkTaggingDataSource.read.data(), filter);

 $.each(query.data, function (index, content) {
         $.each(query.data, function (index, content) {
                   if ($.inArray(content.id, checkedIds) < 0) {
                       checkedIds[content.id] = state;
                   }
         })
   })
});

Filter which we get from $("#FoodGrid").data("kendoGrid").dataSource.filter(): is 

In our case if the {field: 'TotalHours', operator: 'eq', value: '0'} if the filter value is '0'
we get the query.data as empty array and we wont get the expected result.

and filter will work if the {field: 'TotalHours', operator: 'eq', value: '5'}

we are facing issue only for '0' filter. and in schema we have declared 'TotalHours' as number.

Kindly let us know how to fix this issue.

Mark
Top achievements
Rank 1
 asked on 06 May 2022
1 answer
637 views
I have a kendo grid with server side paging and server side filtering. On the same page, I also have a clear button which should clear the data of the grid and replace it with blank rows. Is it possible to clear the filters of that grid, without calling the server side read? Currently when I do this, $("#grid").data("kendoGrid").dataSource.filter({}), it will call the server side function and load the data. Anyone can point me to the right direction? Thanks.
Georgi Denchev
Telerik team
 answered on 11 Apr 2022
1 answer
56 views

In Kendogrid how do we change the default filter options from "is true" and "is  false" to "Yes" and "No"  to match the data in the columns 

Nikolay
Telerik team
 answered on 24 Mar 2022
1 answer
58 views

Hello, i have a gantt which i am working on. This data is organised with multiple levels, sometimes up to 7. We have discovered that when filtering, this works for items up until the second level, but on items underneath the second level, the filtering doesn't seem to be picking up any thing. For instance if we have the following structure (sorry for the simplicity)

Test 1

- Test 2

-- Test 3

---- Test 4

If we try and filter on "Test 1" or "Test 2" then the results will display those rows, but if we try "Test 3" it doesn't return anything. Is there a limit on filtering on a hierarchy in this way?

Neli
Telerik team
 answered on 15 Mar 2022
1 answer
86 views

I faced an issue related to decimal filters.

the issue was "when I enter filer value "6167.1" which actually appears in a grid cell, no result is filtered out so while debugging I found that when data-source is provided to grid that value is actually 6167.07 and kendo jquery UI renders it 6167.1 in the grid.  So when I enter filter value "6167.07" it works and in grid value still appears/ shows 6167.1"

 

According to my understanding filter is working fine on the data source but while rendering it rounds up the data and shows a different value to the client due to which filter errors are reported. 

 

So I need help, please share the code snippet to turn off JS data rounding up used in this kendo library/plugin

Georgi Denchev
Telerik team
 answered on 10 Mar 2022
1 answer
172 views

According to here: https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.filterable.ui

You can (for example) replace a filter input with a textarea, however, the example as shown doesn't work because it's not bound to the filter value.

It will work if you add the data-bind attribute:

$(element).replaceWith("<textarea data-bind='value:filters[0].value'></textarea>");

Now the filter value actually gets passed to the server and populated when you call setOptions on the grid.

As there is no easy way to provide your own filter template, I'm trying to create a complex filter (a checkbox list for a flags enum) using replaceWith.

I have some checkboxes and use some JavaScript to set the value of an input that is bound using the data-bind attribute.

This all works fine and the filter value is passed to the backend as expected, and the input value is populated via setOptions when I reload.

For example:

$("#grid").kendoGrid({
    columns: [ {
        field: "flags",
        filterable: {
            ui: "testFilter"
        }
    } ],
    filterable: true,
    //...
});


function testFilter(e) {
    $(e).replaceWith(`
    <input type='checkbox' value='1' onclick='setFilterInput(this);' />
    <input type='checkbox' value='2' onclick='setFilterInput(this);' />
    <input type='checkbox' value='4' onclick='setFilterInput(this);' />
    <input type='checkbox' value='8' onclick='setFilterInput(this);' />
    <input id='filterInput' type='text' data-bind='value:filters[0].value' />
    `);
}

function setFilterInput(e) {
    var x = $(e).val();
    var c = $(e).is(":checked");
    var input = $("#filterInput");
    var val = parseInt(input.val(), 10);

    if (val === NaN) {
        val = 0;
    }

    input.val(c ? val | x : val ^ x);
    input.trigger("change");
}

The problem is that I need to know the current filter value when the testFilter function is called, so I can check the correct checkboxes when the grid is loaded. For example, this shows an empty value, even when the filter is already set:

function testFilter(e) {
    console.log("the current filter value is", $(e).val());
}

I can't get the value of the filter input because it's bound after the testFilter function is called.

How can I access filters[0].value from inside the testFilter UI function?

Preferably without having to go top-down via $("#grid").data("kendoGrid") etc.

Georgi Denchev
Telerik team
 answered on 22 Feb 2022
2 answers
146 views

I am trying to implement filter which can support relative fields i.e. the first field would be table names once user choose any table then second field gets populated with all columns available for selected table. Now users can choose operator and pass value for filtering the column value. So basically I want to filter on basis of column's value. As I dont want to put all columns for all tables in one field because that makes my drop down very long as I have huge columns in some table and also user wont be able to search specific column easily hence I want to introduce one more field which is table drop down. Once user select from table drop down then column dropdown will only have selected table column which reduce the columns number and user can choose easily. see the attached screenshot for same.  So the expression preview should be something like <field1-N>.<field2-N> <operator> <value> e.g. "table1.column5 is equal to myvalue". How we can achieve this ? I tried using editortemplate of field property of kendo Filter widget and added field 2 as shown in attached screen shot but after that not able to get field 2 value in expression. Can someone suggest what are the other ways we can achieve this ?

Vishwas
Top achievements
Rank 1
Iron
 answered on 08 Feb 2022
1 answer
61 views
Create one form with following fileds and Click on Add button data should add in Kendo Grid.
1.First Name, Last Name.- Validation-Should Accept Only Character /Mandatory Field
2.Date Of Birth-Validation-Should Accept Only Date /Mandatory Field
3.Mobile No -Validation-Should Accept Only Numbers with max 10 /Mandatory Field
4.Description - Non-Mandatory Field
5.Gender -Mandatory Field
6.Added Data Should Filter with First Name ,Last Name And Mobile Number
7.Apply pagination Per page 5 record Should Display

Nikolay
Telerik team
 answered on 07 Feb 2022
1 answer
320 views

Which event can I hook into in order to run custom code before a KendoGrid FilterMenu opens every time?

There is an event that runs once before it opens (filterMenuInit) and an event that runs every time after the menu opens (filterMenuOpen), but I need the third kind, which runs every time before opening.

Nikolay
Telerik team
 answered on 31 Jan 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?