Tree control example

I am having trouble getting a tree control to work. Please could you post some images showing how to fill in the properties.

thanks

Hi John,

Hope this helps:

Take Care,
Josh

2 Likes

Josh,

many thanks for this. I am still in the foothills of learning this so please bear with me. I am also using a works computer and i can't open the TCPIP on my SQL so i can't run Northwind on SQL server to trial this.

Page Load event:
Am I right in assuming that the the value of the $expand parameter is the name of the related Table?

When i try this the app compiles ok but refuses to load the page, it simply hangs.

thanks

John

Yes but it could be the pluralized name so it may differ from the actual table name.

You should see an error in the RadZen output pane when you load the page.

Also please confirm that RadZen recognizes a proper relationship between tables. For example, try creating a Master Detail page. Does the related table appear in the Child selectbox?

HTH,
Josh

Josh,

the master detail form works as it should.
I have three tables:
lkpStatus
tblOppStatus
tblOpportunity

tblOppStatus is the joining table and holds the FKs for the other two.

When try to use the tblOppStatus as the data source fo rthe tree control i get an error merssage saying 'Expression of Type 'System.INt32' cannot be used for return type 'System.String'. I assume this is because the control needs a text value but that value appears in the lkpStatus table.

The way the dsta is strucutred an Opportunity can have many statuses, they change over time so with the old fat client i populated a tree control from a view.
Question: How could i link a vw to the child table? would i have to extend the model ith additional properties ? https://www.radzen.com/documentation/blazor/extend-model-additional-property/

thanks

John

There is a lot you can do in Radzen before needing to get into views.

Unfortunately though I think the Tree component doesn't cooperate.

For example, NtoN Orders > OrderDetails > Products you can getOrders() and $expand "OrderDetails.Product" which essentially over steps the join table.
This is all legal EF code and the app complies and runs.

Then set Tree properties like so:
Level[0]:

  • Schema: Order
  • TextProperty: ShipName
  • ChildProperty: OrderDetails.Product

Level[1]:

  • Schema: Product
  • TextProperty:ProductName

All is good - as you can see the count of children is respective - except the tree component won't render the ProductName.

Weird. Maybe I'm missing something.

I tried another method by extending the model to add a [not mapped] property on OrderDetail which would contain the Product.ProductName, but that was blank too. I think for other reasons namley the OnRead custom method doesn't get called from expand\include - bummer. This would most likely be a blocker to the related db view technique.

Out of time for today - perhaps someone else will chime in.

Take Care
Josh

1 Like

Josh,

many thnaks for your help. Hopefully someone will respond.

thanks

John