I have a kendoGrid with filterable columns using jQuery. Let's say I have a column named Title. When I click on filter icon besides the column name a dropdown occurs that has "Filter" ption and on hovering over "Filter" option a new dropdown containing all the values from the columns is opened. I want this newly opened dropdown to the left always. How can I do so ?
$('#grid').data("kendoGrid");
if (grid != undefined || grid != null)
$('#grid').empty();
var grid = $("#grid").kendoGrid({
dataSource: DataSource,
schema: {
data: function (response) {
return response;
}
},
},
sortable: true,
filterable: true,
columnMenu: true,
reorderable: true,
resizable: true,
multi: true,
selectable: true,
dataBinding: function () {
record = (this.dataSource.page() - 1) * this.dataSource.pageSize();
},
noRecords: true,
messages: {
noRecords: "No records found"
},
pageable: {
pageSize: 5,
input: true
},
columns: [
{
title: "Sr. No.",
template: "#= ++record #",
width: 70
},
{
field: "Title", title: 'Title',
width: "25%",
attributes: {
style: 'white-space: nowrap;'
},
filterable: {
multi: true,
extra: false,
search: true,
operators: {
string: {
eq: "Is equal to",
neq: "Is not equal to",
contains: "Contains"
}
}
}
},
{
command: [
{ name: "edit1", text: "", iconClass: "k-icon k-i-eye", className: "ob-view" }],
title: "Action", lock: true, width: 80, headerAttributes: {
style: "text-align: center;"
}
}
]
});
}
I am trying to create a multifilter from enum data type column using the ItemTemplate. But ItemTemplate Javascript function is not being called and data is not being shown in combobox. Please can you give me a help. Here is the code
Enum Records
public enum EmpTypes { [Display(Name = "Service")] Service = 0, [Display(Name = "Sales")] Sales = 1, [Display(Name = "Purchase")] Purchase = 2, [Display(Name = "Office")] Office = 3 }
Kendo Grid
columns.Bound(c => c.EmpTypes).Title("Type")
.Filterable(filterable => filterable
.Multi(true)
.UI(“”).DataSource(s=>s.Read(r=>r.Action(“GetEmpTypes”,”Report”)))
.ItemTemplate(“typetemplate”));
<script>
function typetemplate(e)
{
alert('Test');
}
</script>
Public ActionResult GetEmpTypes()
{
List<EmpType> emptypes = new List<EmpType>();
emptypes.Add(EmpType.Sales)
emptypes.Add(EmpType.Report)
return Json(emptypes,JsonRequestBehavior.AllowGet);
}
Morning,
I've been using the Kendo Grid for years and absolutely love it for what I can do with it, but every so often I get asked to stretch the functionality of what it can do, I haven't found much documentation on this, but i'll try my best to give an example of what I've done, and to see if there is a better way of doing it..
I have a field in my Grid that is a string, with multiple "Tags" explicitly given in the dataSource in filterable.
{
"columnMenu": {
"componentType": "modern"
},
"stickable": true,
"field": "conditions",
"filterable": {
"enabled": true,
"multi": true,
"search": true,
"dataSource": [
{
"conditions": "TEST123"
},
{
"conditions": "TEST"
},
{
"conditions": "ABC"
},
{
"conditions": "DEF"
}
]
},
"groupable": true,
"aggregates": "count",
"groupHeaderTemplate": "Conditions: #= value # (Count: #= count#)",
"sortable": true,
"title": "Conditions",
The data in the field is a string of comma separated tags, i.e.
TEST, ABC, DEF
I've updated the filter method on the Grid so that I can select multiple options in the filter menu, and it does a "contains" look up to match multiple hits.
filter: function(e){
this.columns.forEach(function(f){
if(e.field === f.field){
if(f.filterable.hasOwnProperty('dataSource')){
e.filter.filters.forEach(function(f){
f.operator = "contains";
e.filter.logic = "and";
})
}
}
})
},
I have two issues here.
1. I'm using contains, so if the tags are similar (TEST, TEST123), selecting TEST will show both TEST and TEST123 - which isn't ideal.
2. If I select an option from the filter menu, it doesn't remain checked if you were to go back into the filter menu again.
I've asked this question before and had some great help to get it to this point using: https://docs.telerik.com/kendo-ui/knowledge-base/grid-how-to-change-multi-checkbox-filter-to-contains but I'm wondering if there is a better way of achieving the functionality I'm looking for here with the grid. I added square brackets to the tags to distinguish them ([TEST], [TEST123]) , but my users didn't like this change.
Is there a way to do this without using contains?
I'd also like to be able to see the selected option in the filter menu - I can find the checkbox through jQuery, but I cannot toggle it's state..
e.filter.filters.forEach(function(f){
var checkbox = $(".k-filter-menu").find("input[value='"+f.value+"']");
console.log(checkbox);
checkbox.prop("checked", true).trigger("change");
checkbox.attr("checked", true).trigger("change");
f.operator = "contains";
e.filter.logic = "and";
})
Thanks for your help,
Matt
On previous updates, selected filters are showing in blue colour.
But now even applying single or multiple filters still color not changed.
I was asked a question a long time ago, but due to communication difficulties I never received the answer I requested.
I've created two example links to ask my question.
To find a unit price of 9,000 won or more in the program below:
Enter ">9000" in the Unit Price field.
This is a feature I developed.
https://www.speedmis.com/_mis/index.php?gubun=3032&isMenuIn=Y&isAddURL=Y
-->
https://www.speedmis.com/_mis/index.php?gubun=3032&isMenuIn=Y&allFilter=[{"operator":"contains","value":">9000","field":"dangga"}] &recently=N&isAddURL=Y
You cannot enter ">9000" if the field is defined as a number.
https://www.speedmis.com/_mis/index.php?gubun=1247&isMenuIn=Y
There was also an auto-completion function when writing numbers.
Special coding allows completion to begin automatically rather than in a number box between numbers.
Please edit the link below if you wish. thank you
https://dojo.telerik.com/OroMIBAK
Hi!
I'm using a Grid with a key-based field with a large list of values.
It works Ok, but when i want to filter by this field, (multi filter) appears hundreds of possible values.
¿Can I reduce the filter values to only existing options in grid elements?
Here is the example:
https://dojo.telerik.com/@larras/atuFikoP
The filter for field country allows all possible values, buy I want to limit the filtering options to the two countries that appear in the grid.
I have tried to use a new reduced collection for values, but in this case, when I add a new row, the country column has not text value and shows the id number.
¿Is possible to change dinamically the "multi" filter collection of values?
Thanks and greetings!
Hi,
Need to understand how I can get the filter and search features for the Kendo grid to search for strings in child grid rows as well as the parent grid rows... right now if I use the Search window, or the Filter feature at the parent level, the Kendo grid will only search in the domain/area of the parent rows.
How can I include the child rows? This is problematic because, as I understand it the child rows are not loaded until the user clicks the left side triangle icon to open the child rows. Customer wants this.
My understanding is this would require all the child rows to rendered... then searched, and all rows with out the string or or substring would be filtered out?
Before I embark on manipulating the grid, wondered if there was a better solution or way to go about this?
Regards,
George