Utility of zdk-synchronize

18 views
Skip to first unread message

ivan....@free.fr

unread,
Nov 9, 2015, 2:26:52 PM11/9/15
to ZnetDK
Hello,
In the view source code of the democrud, the datatable use the class zdk-synchronize.
Can you explain why?

Code Source:

<!-- Datatable -->
 
<div id="demo-crud-table" class="zdk-datatable zdk-synchronize" title="products" data-zdk-action="democrudctrl:data"
       data-zdk-paginator
="10" data-zdk-columns='[
       {"field":"name", "headerText": "Product name", "sortable":true},

       ...
Regards,

Pascal Martinez

unread,
Nov 10, 2015, 4:34:22 PM11/10/15
to zne...@googlegroups.com
Hi Ivan,

The class 'zdk-synchronize' is optional and can be used for optimizing the display of a view when it contains one or several datatables.

Indeed, when this class is set for a zdkdatatable widget, its parent view is only displayed when the datatable's rows are fully loaded from a dedicated remote controller action.

Without this class, the view is displayed just after its loading by an AJAX request, even if the datatables into the view do not have yet their rows loaded.
 
This class only applies to the zdkdatatable widget when the 'office' or 'custom' page layout is configured for your application.

To experiment the behavior described above, add a sleep(5) PHP statement into the controller action that supplies the data rows to a datatable, in order to delay the HTTP response.
Next, remove the 'zdk-synchronize' class to the datatable and open the view from your application.
You will see that the view is displayed with an empty datatable during 5 seconds until the data rows are finally received.

Hoping it is clearer now.

Pascal MARTINEZ
 

ivan....@free.fr

unread,
Nov 12, 2015, 4:42:14 AM11/12/15
to ZnetDK

Pascal,

I have try the “sleep (5)” in the controller code. It’s interesting to see the result.

The  'zdk-synchronize' class is a good optimization. I will use it.

Regards,

Ivan

Reply all
Reply to author
Forward
0 new messages