Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 如何获取PrimeFaces转盘的当前索引?_Jsf_Jsf 2_Primefaces - Fatal编程技术网

Jsf 如何获取PrimeFaces转盘的当前索引?

Jsf 如何获取PrimeFaces转盘的当前索引?,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,我有一个PrimeFaces转盘,我想在其中显示一个可编辑区域。不幸的是,p:carousel似乎没有获取当前索引的属性,就像p:dataGrid中的rowIndexVar一样 仅渲染当前输入区域的其他解决方案有哪些 <p:carousel value="#{infb.infos}" var="info" **rowIndexVar="status"** numVisible="2" > ......

我有一个PrimeFaces转盘,我想在其中显示一个可编辑区域。不幸的是,p:carousel似乎没有获取当前索引的属性,就像p:dataGrid中的rowIndexVar一样

仅渲染当前输入区域的其他解决方案有哪些

        <p:carousel value="#{infb.infos}" var="info" **rowIndexVar="status"** numVisible="2" >
                ......
                        <p:inputTextarea value="#{infb.textArea1}" rendered="#{status == 0 and infb.displayEditor}" />
                        <p:inputTextarea value="#{infb.textArea2}" rendered="#{status == 1 and infb.displayEditor}" />
                        <p:inputTextarea value="#{infb.textArea3}" rendered="#{status == 2 and infb.displayEditor}" />
                        <p:inputTextarea value="#{infb.textArea4}" rendered="#{status == 3 and infb.displayEditor}" />
                        <h:panelGrid rendered="#{infb.displayEditor}" columns="2">
                            <p:commandButton value="Save" action="#{infb.modifyInfoText(info)}" />
                            <p:commandButton value="Cancel" action="#{infb.cancelModifyInfoText(info)}"/>  
                        </h:panelGrid>
                 .....
        </p:carousel>

......
.....
实现(如
等)。该组件类具有一个属性。你可以直接抓住它

首先将
组件绑定到EL(!)中的唯一变量名:


与具体问题无关,这是。为什么不将textarea值绑定到当前迭代的行而不是bean

<p:carousel ... var="item">
    <p:inputTextarea value="#{item.text}" />
    ...
</p:carousel>

...

谢谢您的回答。在primefaces的最新版本中,组件转盘中似乎不再定义属性绑定。我使用的是primefaces 5.3。关于你的第二个建议,我必须修改textarea的值。我不知道你在说什么。您是否在谈论您正在使用的编辑器发出的错误/警告,这些错误/警告阻止您实际尝试运行代码?只需忽略‘n’运行它并更新/替换代码编辑器。至于修改textarea的值,它仍然是可能的,所以我也不理解这里的问题。实际上它是有效的!是的,我说的是NetBeans错误。为什么Carousel类中没有绑定属性?有一个“bindings”继承属性,但没有“binding”。对于第二部分,我认为每个修改的值都必须保存在托管bean属性中?1)documental/IDE bug。2) 它已经是一个托管bean属性。无需复制/展平/展开它。
<p:carousel binding="#{carousel}" ...>
    <p:inputTextarea ... rendered="#{carousel.rowIndex eq 0}" />
    <p:inputTextarea ... rendered="#{carousel.rowIndex eq 1}" />
    <p:inputTextarea ... rendered="#{carousel.rowIndex eq 2}" />
    <p:inputTextarea ... rendered="#{carousel.rowIndex eq 3}" />
    ...
</p:carousel>
<p:carousel ... var="item">
    <p:inputTextarea value="#{item.text}" />
    ...
</p:carousel>