我想要做的是从数据库(num_bc)中填充一个下拉列表。我添加了架构 bc,注册了它,并创建了一个新的目录 bc_directory。一切都很好,我可以看到下拉列表中的值,但是一旦单击它,我就无法选择它的值。
以下是日志内容:
[org.nuxeo.ecm.platform.ui.select2.common.Select2Common] Unable to find field num_bc in directory schema bc. Trying to fallback on default one.
这是我的代码:架构:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://sample.nuxeo.org/sample/schemas/bc/"
xmlns:bc="http://sample.nuxeo.org/sample/schemas/bc/">
<xs:element name="num_bc" type="xs:string"/>
<xs:element name="date" type="xs:date"/>
<xs:element name="fournisseur" type="xs:string"/>
<xs:element name="code_fournisseur" type="xs:string"/>
<xs:element name="entreprise" type="xs:string"/>
<xs:element name="produit" type="xs:string"/>
<xs:element name="quantite" type="xs:string"/>
<xs:element name="montant_total" type="xs:string"/>
<xs:element name="prix_unitaire" type="xs:string"/>
<xs:element name="obsolete" type="xs:string"/>
</xs:schema>
模式注册:
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
<schema name="bc" src="schemas/bc.xsd" />
</extension>
我搜索了生成的错误,我发现我必须删除我没有工作的架构上的前缀。
<extension target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory"
point="directories">
<directory name="bc_directory">
<schema>bc</schema>
<dataSource>java:/nxsqldirectory</dataSource>
<table>bc</table>
<nativeCase>false</nativeCase>
<idField>num_bc</idField>
<autoincrementIdField>false</autoincrementIdField>
<createTablePolicy>on_missing_columns</createTablePolicy>
<querySizeLimit>1000</querySizeLimit>
</directory>
</extension>
版面贡献:
<component name="org.nuxeo.project.sample.layouts">
<extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager" point="widgets">
<widget name="num_bc" type="suggestOneDirectory">
<labels>
<label mode="any">Numéro BC</label>
</labels>
<translated>true</translated>
<fields>
<field>bl:num_bc</field>
</fields>
<properties mode="any">
<property name="width">300</property>
<property name="labelFieldName">num_bc</property>
<property name="dbl10n">true</property>
<property name="minChars">0</property>
<property name="hideHelpLabel">true</property>
<property name="directoryName">bc_directory</property>
<property name="keySeparator">/</property>
<property name="placeholder">Num bc</property>
<property name="documentSchemas">dublincore,layout_demo_schema</property>
<property name="repository">default</property>
</properties>
<controls mode="any">
<!-- enable ajax submit on change/click/select on demo application -->
<control name="supportInsideInputWidgetEffects">true</control>
</controls>
</widget>
</extension>
</component>