寻找一种在java中动态生成dropppable数据网格的方法。我能够在java中动态创建第一部分。这是我遇到麻烦的第二部分..
========第一部分=======
<p:fieldset id="fieldset3" legend="Stuff2">
<p:outputPanel id="dropArea3">
<p:dataGrid id="datagrid3" var="ds" columns="6" rows="1"
value="#{dataSourceController.fieldset3DataSources}"
paginator="true"
paginatorTemplate= "{CurrentPageReport} {FirstPageLink}
{PreviousPageLink} {PageLinks} {NextPageLink}
{LastPageLink}"
paginatorPosition="bottom"
rowsPerPageTemplate="5,10,20">
<p:column>
<p:panel id="pnl" header="#{ds.title}" style="text-align:center">
<h:graphicImage library="images" name="datasource/#{ds.extension}.png"/>
</p:panel>
<p:draggable for="pnl" revert="true" stack=".ui-panel" cursor="move"/>
</p:column>
</p:dataGrid>
</p:outputPanel>
</p:fieldset>
========第二部分=============
<p:droppable id="droppable3" for="fieldset3" tolerance="touch"
activeStyleClass="ui-state-highlight" datasource="datagrid1">
<p:ajax listener="#{dataSourceController.onDataSourceDropToFieldset3}"
update="dropArea3 datagrid1"/>
</p:droppable>
此可放置部分在java:
中不起作用 Droppable drp = new Droppable();
drp.setId("droppable3");
drp.setFor("fieldset3");
drp.setTolerance("touch");
drp.setActiveStyleClass("ui-state-highlight");
drp.setDatasource("datagrid1");
MethodExpression me = FacesUtil.createMethodExpression(
"#{dataSourceController.onDataSourceDropToFieldset3}",
void.class, new Class[]{DragDropEvent.class});
MyAjaxBehavior pajax = new MyAjaxBehavior();
Class[] par = new Class[1];
par[0] = BehaviorEvent.class;
pajax.setListener( me );
pajax.setProcess( "@this" );
drp.setOnDrop("handleDrop");
drp.addClientBehavior( "drop", pajax ); // NOT WORKING - java.lang.IllegalStateException: CDATA tags may not nest
ucDsForm.getChildren().add(drp);
我收到此错误:
java.lang.IllegalStateException: CDATA tags may not nest
具体在执行时发生:
drp.addClientBehavior()
在此期间,我选择跳过动态可放置数据网格创建静态集合5。