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

Kendo grid filter is not working for array of array data in the grid

7 Answers 2934 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sana
Top achievements
Rank 1
Sana asked on 18 May 2016, 12:08 PM

I am trying to apply filter for my grid. It is working fine for normal data in the grid but it is not working for array of array data in the grid. I am using template for rendering the grid data.

Kindly suggest some way to resolve this issue as soon as possible. In below example filter is working for productnumberlist but not working for daterangelist and intelWwlist.

 

var _daterangelist = [];
var _productnumberlist = [];
var _intelWwlist = [];

this.setDaterangelist = function(input){
_daterangelist = input;
}
this.setProductnumberlist = function(input) {
_productnumberlist = input;
}
this.setIntelWwlist = function(input){
_intelWwlist = input;
}
this.assuranceGridOptions = function () {
var selectTemplate = '<input type="checkbox" class="wom-md-checkbox"/>',
customerPartNumberTemplate = '',
intelProductNumberTemplate = '<span>{{dataItem.productNumber | trimLeadingZero}}</span>',
intelProductNameTemplate = '',
intelProcessorNumberTemplate = '',
intelWwTemplate = '#ln=availablelist.length;for (var i = 0; i< ln; i++) {#<span>#="WW"+(availablelist[i].workweek).slice(4)#</span><br>#}#',
dateRangeTemplate = '#ln=availablelist.length;for (var i = 0; i< ln; i++) {#<span>#=availablelist[i].startdate + " To " + availablelist[i].enddate#</span><br>#}#',
requestedQtyTemplate = '#ln=availablelist.length;for (var i = 0; i< ln; i++) {#<span>#=availablelist[i].quantity#</span><br>#}#',
plantTemplate = '#ln=availablelist.length;for (var i = 0; i< ln; i++) {#<span>#=availablelist[i].plant#</span><br>#}#';


var columnStyle = "text-align: center; font-size: 14px; white-space: normal; overflow: visible",
headerStyle = 'text-align: center; font-size: 14px; overflow: visible';

var searchResultsGrid = {
columns: [
{
field: '',
title: '',
width: '50px',
headerAttributes: {style: headerStyle},
attributes: {style: columnStyle},
template: selectTemplate
},
{
field: 'cpn',
title: 'Customer Part #',
headerAttributes: {style: headerStyle},
attributes: {style: columnStyle},
template: customerPartNumberTemplate
},
{
field: 'prodNum',
title: 'Intel Product #',
headerAttributes: {style: headerStyle},
attributes: {style: columnStyle},
template: intelProductNumberTemplate,
filterable: {ui: productnumberFilter}
},
{
field: 'productName',
title: 'Intel Product Name',
headerAttributes: {style: headerStyle},
attributes: {style: columnStyle},
template: intelProductNameTemplate
},
{
field: 'processorNumber',
title: 'Processor #',
headerAttributes: {style: headerStyle},
attributes: {style: columnStyle},
template: intelProcessorNumberTemplate
},
{
field: 'intelWw',
title: 'Intel WW',
headerAttributes: {style: headerStyle},
attributes: {style: columnStyle},
template: intelWwTemplate,
filterable: {ui: intelWwFilter}
},
{
field: 'dateRange',
title: 'Date Range',
width: 210,
headerAttributes: {style: headerStyle},
attributes: {style: columnStyle},
template: dateRangeTemplate,
filterable: {ui: dateRangeFilter}
},
{
field: 'quantity ',
title: 'Qty',
headerAttributes: {style: headerStyle},
attributes: {style: columnStyle},
template: requestedQtyTemplate
},
{
field: 'plant',
title: 'Plant',
headerAttributes: {style: headerStyle},
attributes: {style: columnStyle},
template: plantTemplate
}
],
columnMenu: true,
pageable: true,
noRecords: {
template: "No record found. Please contact your Intel representative for supply assurance information."
},
filterable: {
extra: false,
operators: {
string: {
contains: "Contains",
startswith: "Starts with",
eq: "Is equal to",
neq: "Is not equal to"
}
}
},
dataSource: new kendo.data.DataSource({
selectable: "",
transport: {
read: {
dataType: "json",
cache: false
}
},
schema: {
parse: function (d) {
for (var i = 0; i < d.length; i++) {
if (d[i]) {
return d[i];
}
}
return [];
},
},
filter: {

}
})
};
return searchResultsGrid;
}

this.getEmptyLineItem = function () {
return {
orderID: "",
cpn: "",
intelProductNumber: "",
intelProductName: "",
intelProcessorNumber: "",
intelWw: "",
dateRange: "",
requestedQty: "",
plant: ""
}
}

function productnumberFilter(element) {
element.kendoDropDownList({
dataSource: _productnumberlist,
optionLabel: "--Select Value--"
});
}

function dateRangeFilter(element) {
element.kendoDropDownList({
dataSource: _daterangelist,
optionLabel: "--Select Value--"
});
}
function intelWwFilter(element){
element.kendoDropDownList({
dataSource: _intelWwlist,
optionLabel: "--Select Value--"
});
}

 

7 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 20 May 2016, 07:13 AM

Hello Sana,

 

The dataSource is designed to operate with flat data which is why there is no specified type for 'object' or 'array'. The filtering is handled internally against the original data and it assumes that the data is flat. The columns.template only customizes what is displayed in the cell but the underlying data remains the same. 

 

I am afraid that filtering for array of array of data is not supported by the Kendo UI Grid. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Morten
Top achievements
Rank 2
Iron
Iron
Iron
answered on 04 Apr 2018, 05:32 PM

Hello Support

any update on filtering arrays or elegant work-a-rounds?

I've searched but not found any good examples.

/Morten

0
Stefan
Telerik team
answered on 06 Apr 2018, 06:42 AM
Hello, Morten,

Currently, this could be achieved server filtering an using filter logic on the server to find all of the items that contain the chosen value.

The Grid will send the filter value in the request parameters and then the developer can use different approaches the find the matching arrays values and retund then to the Grid.

Please have in mind that the logic which arrays have to be returned has to be implemented manually.

For now, we do not have any short or mid-term plans to support it, but I can suggest making a feature request for it and based on its popularity we may implement it in a future release:

http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-beta-feedback?category_id=170280

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Chris Voets
Top achievements
Rank 1
answered on 20 Feb 2019, 10:38 AM
filters.push({
field: "myArray",
operator: function (items, filterValue) {
if(items && items.length > 0 && filterValue){
for(let i = 0; i < items.length; i ++){
if(items[i].arratfield == filterValue){
return true;
}
}
}
return false;
},
value: this.comparisonField });
0
Neil
Top achievements
Rank 1
answered on 19 Mar 2020, 04:36 AM
How are we on this front?
A field that can be filtered against array values is very handy really.
0
Martin
Telerik team
answered on 20 Mar 2020, 04:30 PM

Hello Neil,

The feature is still not supported out-of-the-box. Currently it could be achieved only with custom logic executed on the server, as described by my colleague Stefan. If you think that the feature would be a valuable asset to the Grid, you can log a request about it in our Feedback Portal. That will help us evaluate the demand towards the feature.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
answered on 04 Feb 2022, 09:38 PM

Support, 

Can we please get this fixed? It makes the kendo grid unusable so I have to have multiple grid plugins on the site which isn't practical. 

Martin
Telerik team
commented on 08 Feb 2022, 02:49 PM

Such feature is still not implemented in the Grid. As stated previously, you can open a new feature request about it so that we can track the demand towards it.
Tags
Grid
Asked by
Sana
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Morten
Top achievements
Rank 2
Iron
Iron
Iron
Stefan
Telerik team
Chris Voets
Top achievements
Rank 1
Neil
Top achievements
Rank 1
Martin
Telerik team
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
Share this question
or