When I create a dummy filter with the wrapper it no longer throw exception. However even if I disable the Filterable option it still throws and passing filter post data.
.DataSource(ds => ds.Ajax()
.Batch(true)
.Filter(f=> f.Add(d=> true))
Old Post Format:
sort=FacilityName-asc&page=1&pageSize=25&group=&filter=
New Post Format Failing:
sort=FacilityName-asc&page=1&pageSize=25&group=&filter=undefined~undefined~undefined
New Post Format Working - see above for the dummy filter:
sort=FacilityName-asc&page=1&pageSize=25&group=&filter=undefined~eq~null
Please advise.
Patrick
8 Answers, 1 is accepted
I tried to recreate the issue you have described but to no avail. Therefore it will be appreciated if you could provide a small sample in which this issue can be observed locally.
Regards,Rosen
Telerik
I able to track down the issue, I think. If you add the below Array prototype to a .js file or in the master/layout page you'll get the same error but it will work if you add the filter option I mentioned in my first post. Let me know once you add the JS if you are now able to reproduce the issue.
BTW this issue didn't exist before the latest update.
Thanks,
Patrick
1.
Array.prototype.remove =
function
(from, to) {
2.
var
rest =
this
.slice((to || from) + 1 ||
this
.length);
3.
this
.length = from < 0 ?
this
.length + from : from;
4.
return
this
.push.apply(
this
, rest);
5.
};
In the meantime we have identified the caused for the issue and managed to address it. Please download the latest internal build and give it a spin. I have also updated your telerik points as token of gratitude.
Regards,Rosen
Telerik
I got the latest internal bits but the issue is still happening. If you add that bit of JS with the latest bits does it error for you?
Thanks,
Patrick
Could you please confirm if you get the exception or not when adding the JS I posted when using the latest bits.
Thanks,
Patrick
The issue that we discovered (reported by you and few other clients) was related to how complex fields (Category.CategoryID) were handled on sorting/filtering etc. We believe that the internal build in question contains the fix for it.
For your convenience I'm attaching sample project implementing the above described scenario. Sorting/filtering for `Category` column wasn't working with the official Q2 2013 release. It is working with the scripts from the internal build.
If you think that the issue in your project is not related to this, please modify the example in order to replicate the erroneous behavior.
Nikolay Rusev
Telerik
I still have the exception and you can see in the attached code. I've updated it to use the LocalDb vs. SqlExpress as I don't have it installed. I've added the JS in question (adding a remove to Array type) and disabled filtering. However the exception is still thrown. Let me know if you're able to see the exception or not with my updates.
Thanks,
Patrick
As you probably know overriding JavaScript natives prototype is considered bad practice as it may lead to collisions with other libraries. This is exactly the case with the code you use Array.prototype.remove = function () { ... }.
The above code breaks how jQuery.isEmptyObject() function works which distributes the error over our code base.
We will attempt to patch our code in order to avoid the side effects of this override in next internal build, but you should avoid this pattern as it may lead to other unexpected behaviors.
Nikolay Rusev
Telerik