Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add info about binding components with model fields

Table of Contents

...

9. View extensions

Sometimes to add additional content to existing views sometimes it is necessary to create xml file (see View Tab Module or View Ribbon Group Module).

...

Ribbon extension must be defined as:

Code Block
themeEclipse
languagexmlthemeEclipse
linenumberstrue

<?xml version="1.0" encoding="UTF-8"?>

<ribbonExtension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/modules/ribbonExtension" 
	xsi:schemaLocation="http://schema.qcadoo.org/modules/ribbonExtension http://schema.qcadoo.org/modules/ribbonExtension.xsd" 
	plugin="pluginIdentifier"
	view="viewName">

      // HERE YOU PUT RIBBON GROUPS

</ribbonExtension>

...

Window tab extension must be defined as:

Code Block
themeEclipse
languagexmlthemeEclipse
linenumberstrue

<?xml version="1.0" encoding="UTF-8"?>

<windowTabExtension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/modules/windowTabExtension" 
	xsi:schemaLocation="http://schema.qcadoo.org/modules/windowTabExtension http://schema.qcadoo.org/modules/windowTabExtension.xsd" 
	plugin="pluginIdentifier"
	view="viewName">

      // HERE YOU PUT WINDOW TAB

</windowTabExtension>

...

windowTabExtension tag should contains single window tab definition. For more information about window tab definition see 'tabbed window section'.

Important - If you want to correspond with model fields from

Info
titleBinding view components with corresponding model fields inside windowTabExtension

It is important to remember about prepend view component's "field" attribute value with reference to extending view form component.

Example

Code Block
themeEclipse
languagehtml/xml
titlePart of view that we want extend
<view ... >
    ...
    <component type="form" name="someName" reference="someForm">
        // some content
    </component>
    ...
</view>
Code Block
themeEclipse
languagehtml/xml
titleExample definition of component inside body of <windowTabExtension>, related to original view's model field
<component type="input" name="foo" field="#{someForm}.someModelField" />

 

9.3. example

Here is example that extends product view with some fields and add some ribbon items:


productRibbonExtension.xml

Code Block
themeEclipse
languagexml
themeEclipse
linenumberstrue

<ribbonExtension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/modules/ribbonExtension" 
	xsi:schemaLocation="http://schema.qcadoo.org/modules/ribbonExtension http://schema.qcadoo.org/modules/ribbonExtension.xsd" 
	plugin="basic"
	view="product">

     <group name="export">
          <bigButton name="exportProduct" action="#{form}.fireEvent(exportProduct);" />
     </group>
</ribbonExtension>



productViewTabExtension.xml

Code Block
theme
themeEclipse
languagexml
Eclipselinenumberstrue


<windowTabExtension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/modules/windowTabExtension" 
	xsi:schemaLocation="http://schema.qcadoo.org/modules/windowTabExtension http://schema.qcadoo.org/modules/windowTabExtension.xsd" 
	plugin="basic"
	view="product">
     
     <windowTab name="productAdditionalData" reference="productAdditionalData">
          <component type="gridLayout" name="productAdditionalDataLayout" columns="3" rows="4">
               <layoutElement column="1" row="1">	
                    <component type="input" name="additionalNumber" field="#{form}.additionalNumber" />
               </layoutElement>
               <layoutElement column="1" row="2" height="2">	
                    <component type="textarea" name="additionalDescription" field="#{form}.additionalDescription" />
               </layoutElement>
               <layoutElement column="1" row="4">	
                    <component type="checkbox" name="enableAdditionalFunctionality" 
                         field="#{form}.enableAdditionalFunctionality" default="true">
               </layoutElement>
          </component>
     </windowTab>
</windowTabExtension>