Hi,
I have an issue regarding a custom filter operator that doesn't accept string value.
I have a grid and I want to filter the grid's datasource on multiple fields using 'or' logic, using a text input.
I've prepared a jsfiddle: http://jsfiddle.net/angheca001/6BC26/4/
If i pass a numeric value into the input it works fine but the problem is when i put a string value in the input:
I get a 'ReferenceError' telling me that the actual value of the input is undefined (not the variable but the actual value)
Example:
- i put '1' into the input field, it filters fine and shows the row containing '123' in the targets field
- i put 'a' and it says 'ReferenceError: a is not defined'
Thanks,
Catalin
I have an issue regarding a custom filter operator that doesn't accept string value.
I have a grid and I want to filter the grid's datasource on multiple fields using 'or' logic, using a text input.
I've prepared a jsfiddle: http://jsfiddle.net/angheca001/6BC26/4/
If i pass a numeric value into the input it works fine but the problem is when i put a string value in the input:
I get a 'ReferenceError' telling me that the actual value of the input is undefined (not the variable but the actual value)
Example:
- i put '1' into the input field, it filters fine and shows the row containing '123' in the targets field
- i put 'a' and it says 'ReferenceError: a is not defined'
Thanks,
Catalin
5 Answers, 1 is accepted
0
Hello Catalin,
The problem comes from the fact that your targets field in the DataSource cannot be of array type. It only supports - boolean, number, string and date type. It checks only the first item in the targets, so it works for the number, but not for the string fields.
So please reconsider the way you implement the dataSource in your application.
Regards,
Kiril Nikolov
Telerik
The problem comes from the fact that your targets field in the DataSource cannot be of array type. It only supports - boolean, number, string and date type. It checks only the first item in the targets, so it works for the number, but not for the string fields.
So please reconsider the way you implement the dataSource in your application.
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Catalin
Top achievements
Rank 1
answered on 04 Oct 2013, 02:26 PM
Hello Kiril,
Thank you for the answer.
The fact that fields cannot be of type array I can understand, but cannot accept as a cause for the error.
Unfortunately it does not explain the strange behavior because if i switch the order and put string before number (http://jsfiddle.net/angheca001/6BC26/5/)
it still gives error. If it reads only the first item of the array it should work now. But it doesn't.
Actually what I think is that there is an 'eval' there somewhere in the kendo library that is the cause of this error.
Anyways, if you do not consider this as being a bug, maybe in the next kendo update, you will consider accepting also array as a value for datasource fields.
Thanks.
Catalin
P.S. Eval is evil, they say :-)
Thank you for the answer.
The fact that fields cannot be of type array I can understand, but cannot accept as a cause for the error.
Unfortunately it does not explain the strange behavior because if i switch the order and put string before number (http://jsfiddle.net/angheca001/6BC26/5/)
it still gives error. If it reads only the first item of the array it should work now. But it doesn't.
Actually what I think is that there is an 'eval' there somewhere in the kendo library that is the cause of this error.
Anyways, if you do not consider this as being a bug, maybe in the next kendo update, you will consider accepting also array as a value for datasource fields.
Thanks.
Catalin
P.S. Eval is evil, they say :-)
0
Accepted
Hi Catalin,
I have played a bit with your implementation, and managed to make it work. The problem comes from the fact that you should pass the val argument to the indexOf() function, so it can search correctly within the fields. Please check the following link:
http://jsbin.com/OJapOti/1/edit
Regards,
Kiril Nikolov
Telerik
I have played a bit with your implementation, and managed to make it work. The problem comes from the fact that you should pass the val argument to the indexOf() function, so it can search correctly within the fields. Please check the following link:
http://jsbin.com/OJapOti/1/edit
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Catalin
Top achievements
Rank 1
answered on 07 Oct 2013, 12:43 PM
Hi Kiril,
Thank you, it works like a charm!
So the solution is to not pass the value through the framework but to pass it directly.
Thanks again and have a nice week,
Catalin
Thank you, it works like a charm!
So the solution is to not pass the value through the framework but to pass it directly.
Thanks again and have a nice week,
Catalin
0
Hello Catalin,
I am glad that I was able to help.
If you need any further assistance, please do not hesitate to contact us!
Regards,
Kiril Nikolov
Telerik
I am glad that I was able to help.
If you need any further assistance, please do not hesitate to contact us!
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!