2013-06-24 2 views
1

div가 7 개 탭이 있습니다. 각 테이블에는 링크를 클릭하면 테이블이 포함 된 div가 표시됩니다. 이것은 첫 번째 탭에서 작동하고 div 벌금을 표시합니다. 그러나 다른 탭으로 이동하면 div가 표시되지 않습니다. 나는 자바 스크립트에 문제가 있다고 생각하고 jquery에서 고유 한 탭에서 div를 선택할 수 있다고 말할 수 있는지 궁금합니다. 테이블을첫 번째 탭에 struts2 jquery 테이블 만 표시

<sj:tabbedpanel id="leadHomeAppTabs" cssClass="testing" useSelectedTabCookie="true"> 
    <s:iterator id="director" value="directorModel.directorList" status="directorStat"> 
     <s:set var="i" name="counter" value="#directorStat.count" /> 
     <s:url action="directorSummaryView.action" var="directorSummaryViewUrl"> 
      <s:param name="directorModel.directorListIndex" value="%{#directorStat.index}" /> 
     </s:url> 

     <sj:div cssClass="test" label="%{#director.lineOfBusiness}" theme="simple" 
     labelposition="top" id="directorTab%{counter}" loadingText="Loading Line of Business Information..." 
     showLoadingText="true" href="%{directorSummaryViewUrl}" refreshOnShow="false3" preload="false" showErrorTransportText="false" /> 

     <sj:tab id="%{#director.lineOfBusiness}" target="directorTab%{counter}" label="%{#director.lineOfBusiness}"/> 
    </s:iterator> 
</sj:tabbedpanel> 

링크를 채우는 데 사용되는

액션이 DIV에게 내가 보여주고 싶은

<sj:a href="#" onClick="javascript:showDivs('div2');"> 
    <s:property value="directorModel.directorScore.getCountAtLevel(2)"/> 
</sj:a> 

테이블을 표시하기 위해 자바 스크립트를 호출 (각 탭에 DIV2을 호출 할 것이다 I 문제가 발생할 것이라고 생각하지만 탭이 채워지는 방식으로 강제로이 방법으로 작동합니다.)

<sj:div id="div2" cssStyle="display:none"> 
    <table class="table table-striped platform-sum-table" > 
     <thead> 
      <th>Level</th> 
      <th>Application Name</th> 
      <th>ID</th> 
      <th>Current Score</th> 
      <th>Maximum Score</th> 
     </thead> 
     <tbody> 
      <s:property escapeHtml="false" value="directorModel.directorScore.getAppListAtLevel(0)"></s:property> 
     </tbody> 
    </table> 
</sj:div> 

나중에 참조 할 수 있도록 자바 스크립트

<script type="text/javascript"> 
    function showDivs(id) { 
     $("#div2").toggle();} 
</script> 

답변

0

다음 아이디의 독특한 그래서 난이 고유하게 만들기 위해 OGNL을 사용를 werent

<s:set id="dirName" value="directorModel.directorScore.directorName"/> 
<sj:div id="%{dirName}div2" cssStyle="display:none"> 
    <table class="table table-striped platform-sum-table" > 
     <thead> 
      <th>Level</th> 
      <th>Application Name</th> 
      <th>ID</th> 
      <th>Current Score</th> 
      <th>Maximum Score</th> 
     </thead> 
    <tbody> 
     <s:property escapeHtml="false" value="directorModel.directorScore.getAppListAtLevel(0)"></s:property> 
    </tbody> 
</table> 
</sj:div> 
관련 문제