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

ExpressionBuilder in Grid

5 Answers 170 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Lincoln Quinan
Top achievements
Rank 1
Lincoln Quinan asked on 16 Mar 2010, 09:11 PM
Hi,

I'm using the Telerik grid for MVC with our custom Framework Simple.NET (http://code.google.com/p/simpledotnet/), that implements NHibernate to access data layer.
The whole point is that the static class ExpressionFactory has some methods like
public static Expression LiftMemberAccessToNull(Expression memberAccess) 
that generates an IIF in expression, and the implementation that we have can't handle this very well.

Is there a way to use
ExpressionBuilder.Expression<Class>(command.FilterDescriptors)  

without the LiftMember methods ?
I don't wanna change the source code, just want to use the best of the two worlds.

And by the way, the package with the controls is wonderfull !!

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 17 Mar 2010, 08:46 AM
Hello Lincoln Quinan,

In the latest release we try to use the lift member access only when the underlying provider is Linq2Objects. However there was a problem and in some cases this failed. Please download the build attached in this forum thread and let me know if it helps.

Alternatively you can check the implementation - there is class named ExpressionBuilderOptions. In its constructor LiftMemberAccessToNull is set to true. You can remove that statement so it is always false.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lincoln Quinan
Top achievements
Rank 1
answered on 18 Mar 2010, 09:33 PM
My first approach, was to download the build that you have mentioned. But it didn't work.

Then, I have changed the ExpressionBuilderOptions constructor, to deny the LiftMemberAccess behavior.
It works in parts. When I tried to filter numbers and dates, it works fine. But when I tried the search with strings, it raises the same exception that I have taken before.

Unfortunatelly, I have to change my approach and deliver the grid without any fancy filter and sorting. I have put all in a form, with a submit, and I am only rendering a table with 50 items. But I will not give up, and will try to change our framework to parse the expression that the grid is generating in the future.

Other thoughts:
When I go to the 3rd page of my grid and use a filter, what should happen ?
Go to the first page with the results filtered, or, filter the results and go to the 3rd page ?
And if the filter has less than 3 pages ?
I think that the best way of doing that is putting a variable to say if the filter stills the same, or if it has changed.

Your product is amazing and give a boost on productivity. But unfortunatelly, it's very hard to me to change both code (our framework and your source code) to put it to work perfectly.

Anyway, I'm very satisfied with your support and willing to help.
Thanks very much, and I hope that the MVC components still goes on and on !
0
Atanas Korchev
Telerik team
answered on 19 Mar 2010, 09:09 AM
Hi Lincoln Quinan,

If the grid expression engine does not work with your linq provider you can always fallback to custom binding.

During filtering the page is reset to 1. I think this is the expected behavior as the filtered result set may not have enough pages to accommodate the current page.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lincoln Quinan
Top achievements
Rank 1
answered on 24 Mar 2010, 09:30 PM
Now I'm working on CustomBinding with your GridCommand Object

I'm trying to implement a static generic class that get your object, and build an Linq expression tree, that can be used by nHibernate and conventional Linq implementations. I will try to cover the sort options too.

As soon as it get ready for tests, I will publish it as an open source library to help anyone that wants to implementate CustomBinding.
0
Luis
Top achievements
Rank 1
answered on 07 Jan 2012, 03:56 PM
Finally I got it!

With the help of the guys on this thread I'm proud to say that I came to a satisfactory result, pluggable in any type of MVC application without much difficulty and almost none in the settings.

I published the project on Bitbucket and Nuget, please take a look and send me some feedbacks.

https://bitbucket.org/Lunadie/telerikmvcgridcustombindinghelper/wiki/Home 

https://nuget.org/packages/TelerikMvcGridCustomBindingHelper  
Tags
Grid
Asked by
Lincoln Quinan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Lincoln Quinan
Top achievements
Rank 1
Luis
Top achievements
Rank 1
Share this question
or