【问题标题】:How do I use tab index in ui:repeat in primefaces?如何在 ui:repeat 在 primefaces 中使用标签索引?
【发布时间】:2017-05-03 11:14:16
【问题描述】:

我在我的 jsf 页面中使用了一个 ui:repeat,我想在列表的每个元素上使用 tabindex。 我尝试使用以下代码。 请帮我解决这个问题。

<div class="meta-list">
   <p:outputPanel>
      <ui:repeat var="com2" value="#{masterDataBean.mylist}" varStatus="loop" tabindex="1">  
         <p:commandLink value="#{com.value} " action="#{masterDataBean.doSomething}" tabindex="2">
            <f:setPropertyActionListener target="#{masterDataBean.selecteData}" value="#{com2}" />
         </p:commandLink>
      </ui:repeat>
   </p:outputPanel>
</div>

【问题讨论】:

  • ui:repeat 标签上没有类似tabindex 的属性?你到底想做什么?
  • 对于索引,您可以 #{loop.index} varStatus 值。
  • 我想使用列表中的选项卡按钮迭代所有元素。 @Prakash

标签: html jsf primefaces


【解决方案1】:

您可以在ui:repeat 标签上使用#{loop.index} of varStatus="loop"p:commandLinkp:commandLink 设置为动态迭代索引值,如下所示:

<div class="meta-list">
   <p:outputPanel>
      <ui:repeat var="com2" value="#{masterDataBean.mylist}" varStatus="loop">  
         <p:commandLink value="#{com.value}"
             action="#{masterDataBean.doSomething}" tabindex="#{loop.index}">
            <f:setPropertyActionListener value="#{com2}"
                target="#{masterDataBean.selecteData}" />
         </p:commandLink>
      </ui:repeat>
   </p:outputPanel>
</div>

【讨论】:

  • @Mihir:如果我理解你的问题,那应该可以解决问题!
猜你喜欢
  • 1970-01-01
  • 2011-10-23
  • 2012-05-29
  • 2020-05-13
  • 1970-01-01
  • 2015-11-30
相关资源
最近更新 更多