How to use widget List without studio

Hi, I want to use this widget in a view jsf but I dont know how to configure this without nuxeo studio. I have defined a document in nuxeo studio and it has a schema “myschema” and field “myfield”. Now I want show this field in my view view.xhtml but without use documentLayout tag because only have to show one field and field has to be a list widget.

My configurations: -myschema:telefonos multi valued in nuxeo studio -mydocument type in nuxeo studio

-In my plugin: layout definition:

    <layout name="telefonos">
        <templates>
            <template mode="any">/layouts/layout_default_template.xhtml
            </template>
        </templates>
        <rows>
            <row>
                <widget>listArrayWidget</widget>
            </row>
        </rows>
        <widget name="listArrayWidget" type="list">
            <labels>
                <label mode="any">Teléfonos</label>
            </labels>
            <translated>false</translated>
            <fields>
                <field>data.telefonos</field>
            </fields>
            <properties widgetMode="edit">
                <property name="required">true</property>
            </properties>
            <properties widgetMode="any">
                <property name="hideSubLabels">true</property>
            </properties>
            <subWidgets>
                <widget name="listItem" type="text">
                    <fields>
                        <field></field>
                    </fields>
                    <labels>
                        <label mode="any"></label>
                    </labels>
                    <properties widgetMode="edit">
                        <property name="required">true</property>
                        <property name="validator">#{dmValidatorBean.validateTelefono}</property>
                    </properties>
                </widget>
            </subWidgets>
        </widget>
    </layout>

-In my view xhtml:

<a4j:outputPanel ajaxRendered="true">
<nxl:layout name="telefonos" mode="edit" value="#{mySolicitud.currentDocNuxeo}" />
</a4j:outputPanel>

This is showed well in my wizard but when press save button, the changes are not saved. Only are saved the fields text, datetime … Someone can help me?

0 votes

1 answers

3406 views

ANSWER

Hi in my field attribute wrote this: <field>data.myschema.telefonos</field> and this error is showed by the validator: /widgets/list_widget_template.xhtml @179,64 value="#{fieldOrValue}": Target Unreachable, 'myschema' returned null on 'org.nuxeo.ecm.platform.el.DocumentPropertyContext'
05/06/2013



Hi,

Here is the documentation you're looking for.

For this kind of problems the Platform Explorer is very useful: assuming you already know how to create and use a widget through XML (otherwise, you'll have to read this), see this page to find examples of widgets that use the “list” widget type in Nuxeo.

The layout showcase can also be useful.

Here is one:

   <widget name="dr_listing_no_comments" type="list">
    <labels>
      <label mode="any">label.content.header.comments</label>
    </labels>
    <translated>true</translated>
    <fields>
     <field>data.document.tkst.comments</field>
    </fields>
    <properties widgetMode="edit">
      <property name="orderable">false</property>
      <property name="diff">false</property>
      <property name="display">table</property>
      <property name="required">false</property>
      <property name="hideSubLabels">true</property>
    </properties>
    <properties mode="any"/>
    <subWidgets>
      <widget name="sub0" type="text">
        <labels>
          <label mode="any"/>
        </labels>
        <translated>false</translated>
        <fields>
          <field/>
        </fields>
        <properties mode="any"/>
      </widget>
    </subWidgets>
  </widget>

Is your property is just a list of strings, you can get things done by just copy/pasting and tweaking the above XML.

2 votes



Hi, it works but in my attribute field I wrote this: <field>myschema:telefonos</field> Thanks
05/07/2013