One thing I really try to avoid is making a lot of "redundant" grids ... where only a few things have changed.
Mostly because of the obvious... when 1 thing needs to be changed I have to do it in multiple grids which are basically the same. I hate doing redundant work.
I find that I might want to have a grid of Current Orders for a Dept. Manager. (only orders in that Dept.)
And a "Admin" in the company needs to see ALL Current Orders.
And a Sales Rep only see his Order. Open & Closed.
All the columns are basically the same (and Aware conditions on columns could hide a few if needed).
But what changes is the Query CRITERIA
(NOTE: Before you say it, YES, I realize I can create one hell of a convoluted Query string with "conditions" in it to do this - but thats extremely messy and not as cool as the solution below.)
Seems like it would be convenient if I had a Rules table with multiple conditions for selecting Criteria & ORDER BY
After all, this only needs to be evaluated ONCE when the Grid is displayed at runtime before getting data from the DB - and then the Query gets assembled and sent to the backend.
CRITERIA (ie. WHERE): (note: LISU = LoggedInSystemUser, but could be other things or functions, but LISU for version 1)
CND = LISU.AccessLevel='Manager' --> Criteria= 'where Dept=Manager`sDept and Status=Open'
CND = LISU.AccessLevel='Admin' --> Criteria= 'where Status=Open'
CND = LISU.AccessLevel='Sales' --> Criteria= 'where Status=Open or Closed'
SORTING:
CND = LISU.tmpFlag='A' --> ORDER='Dept, Model'
CND = LISU.tmpFlag='B' --> ORDER='Rep, OrderDate'
Just make it easy and use the first matching condition in each section
AND, while I'm making this up, it would be nice to specify a GROUP BY which would activate the Kendo Grouping.
GROUPING:
CND = LISU.AccessLevel='manager' --> GROUP='Rep'
CND = LISU.AccessLevel='user' --> null this is not even needed for "user"
I have a Grid now, when used by an EndUser, the Grouping makes no sense - its only his/her records.
But when a Manager is looking at data, the Grouping COULD be used.
But there's no Dynamic way to turn on/off Grouping.