Hello,
I have a page with a datagrid generated with Radzen scaffolding.
I need to load the same datagrid with two differents set of data depending on a checkbox state:
the table X;
the view Y with same columns of table X but less rows;
Both X and Y have one to many relationships with other tables.
I supposed I can do this in the checkbox change event:
depending on checkbox state
invoke right datasource
set getXResult and getXcount
execute this.grid0.load()
I supposed also I can copy steps directly from datagrid loaddata event.
Unfortunately it seems it is not working, I see query are executed but I do not see the query on the view.
Am I following the right path? Can you give me some hints ?
Thanks,
Mario
Ok I have discovered the problem and it is a big blocking one.
Your code generator for class X has generated a model with correct ForeignKey attributes.
Unfortunately for view Y has generated a model with no attributes even if the view has foreign keys relationships.
How can I save this situation?
I will do.
I add that putting in the same script two "invoke datasource" (with condition) seems to confuse/break the "create query" gui in parameters section. I cannot set different filters for the two "invoke datasource".
Is it possible?
I can describe behaviour. The first "invoke datasource" has a filter defined, the second is empty.
If I go in first one and in "create query" I see the filter, then I go in to the second "create query" and I see the same filter (it should be empty).
If I do the reverse all is empty also the first one.
It does not do this all times I try.
I've checked your schema and I've realized that you are referring to SQL Views. Radzen can retrieve and work with relationships between SQL tables only.
We will do our best to add it as soon as we can! In the meantime the only workaround I can suggest is to construct queries with $filter using Query Builder to retrieve related records between tables and views.
I was doing the "hard way" using a custom method inside ServerMethodController.
In this case I am blocked because ServerMethodController inherits from Controller and I need to inherit from ODataController to have pagination and other features (I suppose... I am newbie in dotnet).
But then you suggest me to "construct queries with $filter".
My problem infact is really simple, in filter I have:
Reparto/Ruolo eq '${security.user.roles[0]}'
And in the model of the database view I have no foreignkey relationship for reparto and ruolo.
Is it possible to modify the filter to manually specify relationships?
Ok as a workaround I created to new views with left join so I have all fields I need without needs to do joins using filters.
Anyway I am interested to know:
if I can used OData in ServerMethodController
what do you mean in : construct queries with $filter using Query Builder to retrieve related records between tables and views.