Client-side UI Composing"

From Documentation
m ((via JWB))
(44 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
  
=Overview=
+
Though optional, you could have the total control of the client's functionality without the assistance of server-side coding. Generally, you don't need to do it. You don't even need to know how ZK Client Engine and client-side widgets communicate with the server. Their states can be synchronized automatically with ZK. However, you can still control this type of synchronization if you want. It is the so-called Server-client fusion.
  
[[File:ZKComDevEss_widget_component_application.png]]
+
A good rule of thumb is that you should handle events and manipulate UI mostly, if not all, on the server, since it is more productive. Then, you could improve the responsiveness and visual effects, and/or reduce server loading by handling them at the client, when it is appropriate. Notice that JavaScript is readable by any user, so be careful not to expose sensitive data or business logic when migrating some code from server to client.  
  
An UI object visible to a user at the client is hosted by a JavaScript object<ref>It actually depends on the device. For Ajax, it is a JavaScript object. For Android devices, it is a Java object.</ref> called widget. On the other hand, a component is a Java object at the server that an application manipulates directly. Once a component is attached to a page, a widget is created at client automatically. Furthermore, any state change of the component at the server will be updated to the widget at the client.
+
* About client-side UI composing, please refer to [[ZK Client-side Reference/General Control/UI Composing|ZK Client-side Reference: UI Composing]].
 +
* About customizing client-side widget's behavior, please refer to [[ZK Client-side Reference/General Control/Widget Customization|ZK Client-side Reference: Widget Customization]].
 +
* About client-side event handling, please refer to [[ZK Client-side Reference/General Control/Event Listening|ZK Client-side Reference: Event Listening]]
  
You need not to know the existence of widgets. Ajax requests and state synchronization are handled automatically by ZK and the components you use. However, you are allowed to instantiate or alert any client-side widgets directly at the client (in JavaScript). It is the so-called Server+client fusion.
+
=Version History=
  
The rule of thumb is to compose and manipulate UI at the server first since it is easier. Then, you could reduce the load of the server by composing some UI at the client when it is appropriate.
+
{| class='wikitable' | width="100%"
 
 
Here we describe how to compose UI at the client. For client-side event handling, please refer to the [[ZK Developer's Reference/Event Handling/Client-side Event Listening|Client-side Event Handling]] section.
 
 
 
<blockquote>
 
----
 
<references/>
 
</blockquote>
 
 
 
=Version History=
 
Last Update : {{REVISIONYEAR}}/{{REVISIONMONTH}}/{{REVISIONDAY}}
 
{| border='1px' | width="100%"
 
 
! Version !! Date !! Content
 
! Version !! Date !! Content
 
|-
 
|-

Revision as of 07:37, 8 July 2022


Client-side UI Composing


Though optional, you could have the total control of the client's functionality without the assistance of server-side coding. Generally, you don't need to do it. You don't even need to know how ZK Client Engine and client-side widgets communicate with the server. Their states can be synchronized automatically with ZK. However, you can still control this type of synchronization if you want. It is the so-called Server-client fusion.

A good rule of thumb is that you should handle events and manipulate UI mostly, if not all, on the server, since it is more productive. Then, you could improve the responsiveness and visual effects, and/or reduce server loading by handling them at the client, when it is appropriate. Notice that JavaScript is readable by any user, so be careful not to expose sensitive data or business logic when migrating some code from server to client.

Version History

Version Date Content
     



Last Update : 2022/07/08

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.