|
|
(3 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | {{ZKDevelopersReferencePageHeader}}
| + | #REDIRECT [[ZK Developer's Reference/MVVM/Data Binding]] |
− | | |
− | The Data Binding Manager can be activated by defining the page Initializer at the top of every page.
| |
− | | |
− | <source lang="xml" >
| |
− | <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
| |
− | </source>
| |
− | | |
− | For example, the page may looks like
| |
− | | |
− | <source lang="xml" >
| |
− | <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
| |
− | <zk>
| |
− | <window apply="org.zkoss.demo.MyComposer">
| |
− | </window>
| |
− | </zk>
| |
− | </source>
| |
− | | |
− | After ZK 5.0.8 there is a new and cleverer way in which users can adopt to do achieve the same outcome – by defining a dedicated Composer – AnnotateDataBindingComposer. The page with this way may looks like
| |
− | | |
− | <source lang="xml" >
| |
− | <zk>
| |
− | <window apply="org.zkoss.demo.MyComposer,org.zkoss.zkplus.databind.AnnotateDataBindingComposer">
| |
− | </window>
| |
− | </zk>
| |
− | </source>
| |
− | | |
− | For more information, please refer to the relative blog post
| |
− | [http://blog.zkoss.org/index.php/2011/08/11/databinding-composer/ Databinding Composer]
| |
− | | |
− | This initiator class does the following things:
| |
− | | |
− | # Creates an <tt>AnnotateDataBinder</tt> instance.
| |
− | # Sets the <tt>AnnotateDataBinder</tt> instance as a variable with the name "''binder''" stored in the component as specified in <tt>arg0</tt> "component-path".(if arg0 is not specified, use <tt>Page</tt> instead.)
| |
− | # Calls <tt>DataBinder.loadAll()</tt> to initiate all UI components from the associated data source.
| |
− | | |
− | =Version History=
| |
− | {{LastUpdated}}
| |
− | {| border='1px' | width="100%"
| |
− | ! Version !! Date !! Content
| |
− | |-
| |
− | |
| |
− | |
| |
− | |
| |
− | |}
| |
− | | |
− | {{ZKDevelopersReferencePageFooter}}
| |