1

我想要一个可以移动/排序并同时可编辑的条目列表。所以我很难p:orderListp:inplace这种方式结合:

<p:scrollPanel style="width:300px;height:100px" scrollMode="native">
    <p:orderList var="title" value="#{detailModel.afterObject.metadata.getTitlesAsList()}" type="definition">
        <f:facet name="description">
            <p:inplace id="basic" editor="true">
                <p:inputText value="#{title.value}" required="true"/>
            </p:inplace>
        </f:facet>
    </p:orderList>
</p:scrollPanel>

但我收到以下错误:

java.lang.NullPointerException
    at org.primefaces.component.orderlist.OrderListRenderer.encodeOptions(OrderListRenderer.java:152)
    at org.primefaces.component.orderlist.OrderListRenderer.encodeList(OrderListRenderer.java:108)
    at org.primefaces.component.orderlist.OrderListRenderer.encodeMarkup(OrderListRenderer.java:79)
    at org.primefaces.component.orderlist.OrderListRenderer.encodeEnd(OrderListRenderer.java:49)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:61)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:45)
    at org.primefaces.component.scrollpanel.ScrollPanelRenderer.encodeMarkup(ScrollPanelRenderer.java:51)
    at org.primefaces.component.scrollpanel.ScrollPanelRenderer.encodeEnd(ScrollPanelRenderer.java:30)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
    at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:619)

我错过了什么还是不可能这样做?

如果我改用 :dataList ,我不会收到错误,但它的行为很奇怪;当我单击一个条目时,所有条目都变为可编辑的,但随后它们仍处于编辑模式,没有更多可能...

滚动、确认和取消没有效果

有什么建议么?

编辑

这是豆:

public class DoiDetailModel extends DetailModel
{
    private List< String >      selectedTitles;
    private List< String >      selectedCreators;

    private String              title;
    private String              creator;

    public DoiDetailModel()
    {
        super();
    }

    public List< String > getSelectedTitles()
    {
        return selectedTitles;
    }

    public void setSelectedTitles( List< String > selectedTitles )
    {
        this.selectedTitles = selectedTitles;
    }
}
4

0 回答 0