merdj
merdj

Reputation: 11

delphi 2010 datasnap return treeview from server

is it possible in Delphi Datasnap 2010 to transfer treeview from Datasnap 2010 server to DataSnap Client?

thanks

Upvotes: 1

Views: 581

Answers (3)

mjn
mjn

Reputation: 36644

Instead of transferring GUI elements from servers to clients, it is a common practice to transfer the data only (for example as 'data transfer objects', DTO) which can easily be (de-)serialized using open source libraries like OmniXML, NativeXML or SuperObject.

The presentation layer can change easily (think of HTML or mobile clients) this way.

The definition for DTO can be found on Martin Fowler's site.

Upvotes: 1

alex
alex

Reputation: 1156

DataSnap can serialize objects using JSON. I recommend you create a tree structure in which you would store the nodes and then populate your treeview accordingly.

And no, you cannot serialize a VCL TTreeView.

Upvotes: 0

Bruce McGee
Bruce McGee

Reputation: 15334

You might be able to kludge something together that creates and populates a VCL control on the server and serialize the control to the client, but it seems ugly.

I would have it return the data that represents a tree and use that to populate a treeview on the client side, instead.

NodeId  NodeName  ParentId
0       Root      -1
1       Node1     0
2       Node2     0
3       Node3     0
4       Node1.1   1

Upvotes: 2

Related Questions