我正在编写一个拖放组件,用户可以将一个简单的面板拖放到 dataGrid 中,我的问题是当我放下一个新面板时,datagrid 没有动态改变大小。那么是否有要设置的属性或其他东西。这是我遵循的示例http://www.primefaces.org/showcase/ui/dndGrid.jsf 提前谢谢。
这是我的代码:
<h:panelGrid columns="2" cellpadding="10">
<p:column>
<p:fieldset id="belongTo" legend="Belong To" >
<p:dataGrid id="userGroups"
var="userGroup"
value="#{projectAdminisrationMB.selectedUserMemberOfGroups}"
columns="3">
<p:column>
<p:panel id="pnl1"
header="#{userGroup.name}"
style="text-align:center">
<h:panelGrid columns="1" style="width:100%">
<p:graphicImage value="/images/group/adminGroup.gif"/>
</h:panelGrid>
</p:panel>
<p:draggable for="pnl1"
revert="true"
handle=".ui-panel-titlebar"
stack=".ui-panel"/>
</p:column>
</p:dataGrid>
</p:fieldset>
<p:droppable for="belongTo"
tolerance="touch"
activeStyleClass="ui-state-highlight"
datasource="userNotGroups" >
<p:ajax listener="#{projectAdminisrationMB.onExcludeFromGroupDrop}" />
</p:droppable>
</p:column>
<p:column>
<p:fieldset id="excludeFrom"
legend="Exclude From"
style="margin-top:20px">
<p:dataGrid id="userNotGroups"
var="userNotGroup"
value="#{projectAdminisrationMB.selectedUserNotMemberOfGroups}"
columns="3">
<p:column>
<p:panel id="pnl2"
header="#{userNotGroup.name}"
style="text-align:center">
<h:panelGrid columns="1" style="width:100%">
<p:graphicImage value="/images/grou/defaultGroup.gif"/>
</h:panelGrid>
</p:panel>
<p:draggable for="pnl2"
revert="true"
handle=".ui-panel-titlebar"
stack=".ui-panel"/>
</p:column>
</p:dataGrid>
</p:fieldset>
<p:droppable for="excludeFrom"
tolerance="touch"
activeStyleClass="ui-state-highlight"
datasource="userGroups" >
<p:ajax listener="#{projectAdminisrationMB.onBelongToGroupDrop}" />
</p:droppable>
</p:column>
</h:panelGrid>