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

Multi-filter shows nothing except "Select All" after update to Q2

4 Answers 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 25 Jun 2015, 11:40 PM
My application has a ton of grids with a ton of columns so we've got a bunch of slick code to essentially generate most of the grid settings based upon schema objects. Yesterday I began working on the Excel-like multi-filtering. I was working with the Q1 and got it working nicely except for 2 things. Filtering "null" wasn't working at all, and filtering dates wasn't working. Today I sat down to fix those 2 problems and realized I had just barely missed the Q2 release. Wondering if these issues were fixed I find I can't even get far enough to find out.

 

I've got the following code which generates the multi-filter based upon a schema object representing a given field.

 
column.filterable = column.filterable || {};
column.filterable.multi = true;
column.filterable.dataSource = {
    type: "aspnetmvc-ajax",
    transport: {
        read: {
            url: excelFilterUrlBase + "/" + field.charAt(0).toUpperCase() + field.slice(1), // Evaluates to something like 'api/Employees/LastName'
            data: primaryDataSource.transport.read.data,
            type: "GET",
            dataType: "json"
        }
    },
    schema: {
        data: "data",
        total: "total",
        model: (function (fieldName, field) {
            var modelObject = {
                id: fieldName,
                fields: {}
            };
            modelObject.fields[fieldName] = {
                type: field.type
            }
            return modelObject;
        })(field, fields[field]) // Evaluates to a proper model object having the correct 'type'
    },
    filter: primaryDataSource.filter
}

 

When I run this code and then click on the column menu dropdown, I see in the network traffic that it properly calls my service method, and gets back the appropriate JSON response object:

{
data: [
{
lastName: "Aaron"
},
{
lastName: "Abbas"
},
{
lastName: "Abbott"
},
{
lastName: "Adams"
},
{
lastName: "Adhikari"
},
{
lastName: "Agarwal"
},
{
lastName: "Aggarwal"
},
{
lastName: "Aguilar Schall"
},
//...
],
total: 908,
aggregateResults: null,
errors: null
}

 

However, In my grid, I only see the "Select All" checkbox. There aren't any other options.

 

This was working in Q1. What changed?

4 Answers, 1 is accepted

Sort by
0
Aaron
Top achievements
Rank 1
answered on 26 Jun 2015, 12:00 AM

To narrow this down there's a couple other things I've tried.

I've tried removing the "schema" object and changing my services layer to return a simple array of strings, as well as trying a simple array of objects with the fieldname as the key. No luck.

Also worth noting that I'm also using the filter row.

 Additionally, there are no errors being thrown in the console.

 

And since probably the first thing anybody is going to think is that something's up with my closures, this is what I see when I use angular to inspect the variables at runtime:

 

filterable: {
    cell: {
        operator: "contains",
        showOperators: true,
        suggestionOperator: "contains"
    },
    dataSource: {
        filter: [],
        schema: {
            data: "data",
            model: {
                fields: {
                    lastName: {
                        type: "string"
                    },
                    id: "lastName"
                }
            },
            total: "total"
        },
        transport: {
            read: {
                dataType: "json",
                type: "GET",
                url: "/api/Employee/Field/LastName"
            }
        },
        type: "aspnetmvc-ajax"
    },
    multi: true
}

0
Aaron
Top achievements
Rank 1
answered on 29 Jun 2015, 07:19 PM

So I'm passing the filter object that the entire datasource is instantiated from in order to only show values that actually exist. My server-side code applies that filter to the data set before using reflection to pull the appropriate distinct property values.

What's missing that makes this whole thing not work?

serverFiltering: true

0
Georgi Krustev
Telerik team
answered on 30 Jun 2015, 08:28 AM
Hello Aaron,

I prepared a simple Dojo demo in my attempt to replicate the issue locally, but to no avail. Probably I am missing something. Would it be possible to modify it and show us the erroneous behavior? As a side note, the MultiCheck widget will not be visible when filter row is enabled.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Aaron
Top achievements
Rank 1
answered on 06 Jul 2015, 08:52 PM
Adding
serverFiltering: true
 fixed the issue. I was unable to replicate the issue in the demo. Probably because I'm using the asp.net wrappers and returning a DataSourceResult containing the options.
Tags
Grid
Asked by
Aaron
Top achievements
Rank 1
Answers by
Aaron
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or