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 call a function from the javascript from filter. If I try to filter the column , the function is not being called. There is no any error in console and the value is coming into the grid. But just that trigger is not called when filter the column. Also I wondering if I remove the function from the script , it will look for the function and will give the error function not found. But if there is function, it will not call the function and alert message is not getting
We are using the latest version of Kendo Telerik grid. Why the filterable.UI does not work in Asp.net core MVC? How can I find the reason why it is not called?
Here is my code
columns.Bound(e => e.City)
.Filterable(filterable => filterable.UI("cityFilter"))
.Width(200);
<script type="text/javascript">
function cityFilter(element) {
alert('testting'
}
</script>
I have a model DateTime property called CreatedDate and If I try to filter by date using the filter 'Is equal to' for a single date, it will not filter the records for the given date due its time part in it filter checking. So How can I make it filter truncating the time part from the filter ?
Pol
public class EmployeeViewModel { public string Name{get; set;} public DateTime CreatedDate{get; set;} } In Kendo Grid column.Bound(c=>c.CreatedDate).Title("Created Date")
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