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

[Solved] Grid row filtering issue/question

2 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 14 Mar 2015, 04:36 AM
I am using a REST service to populate a grid. One of the data items returned in the dataSource is an array with a single value; like this:

"Assignee": ["John Doe"]

When I attempt to display this in a grid column, it simple shows [object Object] since it is an array and not a string I assume. So I used a column template to get the value to display: columnItem.template= "#= Assignee.filter(Boolean) #" and this works fine

My issue comes in when I try to use the filter row field for this column. Doing so results in this error: TypeError: "".toLowerCase is not a function. This also happens if I use the standard filter menu option.

So my question would be, is there something else that can be done to get the filtering to work in this scenario? I have not yet tried setting a schema that states the Assignee column is text. That's next, but thought I would post my question here as I've spent an evening trying to figure out a solution to no avail.

Any insight or assistance is greatly appreciated and I can provide more info if anything is unclear.

Thanks

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 18 Mar 2015, 08:32 AM
Hello Bill,

I'm afraid that filtering on field which value is an array is not supported. You should consider changing the data to be just the string value. If this is not possible on the server you may try using the dataSource.schema.model.fields.parse function. Similar to the following:

dataSource: {
  /*...*/
  schema: {
    model: {
      fields: {
             /*...*/
        "Assignee": {
          parse: function(value) {
            return value[0];
          }
        }
      }
    }
  }

This also will eliminate the need for using the column template.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bill
Top achievements
Rank 1
answered on 23 Mar 2015, 11:13 PM
Figured the issue was the array value and that not being supported, thanks for the confirmation. The parse function of the schema looks like it should do the trick - thanks much for the reply.
Tags
Grid
Asked by
Bill
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Bill
Top achievements
Rank 1
Share this question
or