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

[Solved] Conditionnal Cell Values

0 Answers 136 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.
Beedoo
Top achievements
Rank 1
Beedoo asked on 21 Jun 2010, 03:25 PM
Hi,

I'm using the Telerik Grid for ASP.NET MVC and I would like to know if it is a way to intercept the data source just after it has been processed by the GridDataProcessor to change some value in the source.

I explain myselft. Our business needs that some cell values will be hidden in the grid. For exemple, if a user is showing the list of the company's employees, he should see only the salary of people that are under him in the hierarchy.

First, I choose to pass an Action to the template of my GridColumnBuilder to replace indesirable data by a character (-). It works very well in cases where grouping and sorting is not activated.

Taking the same example as previously, I can obtain the following grid :

FirstName    LastName    Salary
F1                L1                1000
F2                L2                1200
F3                L3                800
F4                L4                - <-- desactivated field
F5                L5                - <-- desactivated field

If I activate sorting, logically, the sort is applied on all values (and - are not the real value) so I obtain :

FirstName    LastName    Salary ^
F3                L3                800
F4                L4                - <-- desactivated field
F5                L5                - <-- desactivated field
F1                L1                1000
F2                L2                1200

Now I've an idea of the range of my boss salary :-)

Is it any way to get the following ?

FirstName    LastName    Salary ^
F3                L3                800
F1                L1                1000
F2                L2                1200
F4                L4                - <-- desactivated field
F5                L5                - <-- desactivated field

If I choose to group the grid by salary, it's worst because I obtain the hidden values in the group headers :

                    FirstName    LastName    Salary ^
Salary : 800
                    F3                L3                800
Salary : 900
                    F4                L4                - <-- desactivated field
Salary : 950
                    F5                L5                - <-- desactivated field
Salary : 1000
                    F1                L1                1000
Salary : 1200
                    F2                L2                1200

Is it any way to get the following ? 

                    FirstName    LastName    Salary ^
Salary : 800
                    F3                L3                800
Salary : 1000
                    F1                L1                1000
Salary : 1200
                    F2                L2                1200
Salary : -
                    F4                L4                - <-- desactivated field
                    F5                L5                - <-- desactivated field

I think that I can obtain this result if I filter the data source before passing it to the grid, but in this way I will loose all the advantages of the grid that is able to group, sort, filter directly a IQueryable so directly in the database. I can't include the rules that hide some cell values in the IQueryable because these are scripted rules generated dynamically.

I hope I was clear because the problem is not easy to explain and really appreciate if anyone can help me

Thanks in advance

Julien CORIOLAND
Tags
Grid
Asked by
Beedoo
Top achievements
Rank 1
Share this question
or