views:

104

answers:

4

Hello To All:

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

thanks

+2  A: 

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
Bruce McGee
A: 

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.

alex
+1  A: 

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.

mjustin
A: 

@mjustin,

how could use like nativeXML, from DataSnap Server To DataSnap Client? Kindly direct me please, show a good example.

Thanks for a care,

merdj