2012-03-26 74 views
0

我使用Primefaces 3.2库珀蒂诺主题:primefaces单选按钮保持“选中”使用jQuery

<context-param> 
    <param-name>primefaces.THEME</param-name> 
    <param-value>cupertino</param-value> 
</context-param> 

当我在一个单选按钮,单击它成为检查..但是,如果我尝试取消选中jquery它仍然检查..我在底部链接中使用一个简单的JavaScript函数。

screen image

如下XHTML页面:

<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
     xmlns:ui="http://java.sun.com/jsf/facelets" 
     xmlns:f="http://java.sun.com/jsf/core" 
     xmlns:h="http://java.sun.com/jsf/html" 
     xmlns:p="http://primefaces.org/ui"> 

    <h:head> 
    <title>Custom Radio Test</title> 
    <script type="text/javascript"> 

     function uncheckTest() { 

     var myRadio = $("#mF\\:vB\\:0\\:vBI\\:0\\:ITRadioGrp\\:0"); 
     alert("RADIO : " + myRadio.get(0).id + "  CHECKED :" + myRadio.is(':checked')); 
     myRadio.removeAttr("checked"); 
     myRadio.prop('checked', false); 

     alert("RADIO : " + myRadio.get(0).id + "  CHECKED :" + myRadio.is(':checked')); 

     } 

    </script> 
    </h:head> 

    <h:body> 

    <h:form id="mF" > 

     <div> 

     <ui:repeat id="vB" value="#{testBean.groupOfVB}" var="aViewBoxPrice" varStatus="vbpindex" > 

      <ui:repeat id="vBI" value="#{testBean.groupOfIT}" var="aItinerary" varStatus="itiindex" > 

      #{itiindex.index + 1}° group 

      <p:selectOneRadio value="#{testBean.radioSelectedValue}" id="ITRadioGrp" layout="custom" > 
       <f:selectItems value="#{testBean.selectItems}" /> 
      </p:selectOneRadio> 

      <ui:repeat id="vBGOF" value="#{testBean.groupOfFlights}" var="aFlight" varStatus="gofIndex"> 
       <p:radioButton for=":mF:vB:vBI:ITRadioGrp" itemIndex="#{gofIndex.index}"/> #{aFlight} 
       <br /> 
      </ui:repeat> 

      <br /> 
      </ui:repeat> 

      <br /> 
     </ui:repeat> 

     <a href="javascript:uncheckTest()">UNCHECK</a> 

     </div> 


    </h:form> 

    </h:body> 

</html> 

我不明白为什么.. 谢谢!

回答

0

这是因为primefaces CSS ..我不得不取消收音机与jquery ..