2010-07-12 9 views
0
<table class="display" id="jquerytable"> 
    <thead> 
    <tr> 
     <th>Name</th> 
     <th>BillingAddress</th> 
     <th>DeliveryAddress</th> 
     <th>Eng 1</th> 
     <th>Eng 2</th> 
    </tr> 
    </thead> 
    <tbody> 
    <% foreach (var item in Model) { %> 
    <tr> 
     <td><%= Html.Encode(item.Name) %></td> 
     <td><%= Html.Encode(item.BillingAddress) %></td> 
     <td><%= Html.Encode(item.DeliveryAddress) %></td> 
     <td><%= Html.Encode(item.Engineer1Id) %></td> 
     <td><%= Html.Encode(item.Engineer2Id) %></td> 
    </tr> 
    <% } %> 
    </tbody> 
</table> 

Eng 1 및 Eng 2를 숨기려면 어떻게해야합니까? 나는 위트를 보았는데 = "거짓"이지만 성공하지 못했습니다.<th> 및 <td> 태그

+0

jQueryTable에서 사용하는 것으로 가정하는 jQuery에서 클래스 나 ID를 지정하면 $ ("# myId"). hide() 또는 $ (". myClass").숨는 장소() – Alistair

답변

1

MattMitchell은 대부분 옳은;

<th style="visibility: hidden;"> 

display: none;visibility: hidden;의 차이가 none 문서 흐름에서 요소를 받아 visibility 단지 그것을 숨기는 것입니다 : 당신은 정말 사용하고 싶습니다. 따라서 hidden을 사용하면 이상한 레이아웃 효과가 발생할 가능성이 줄어 듭니다.

1

당신은 또한 클래스

<th style="display: none;"> 

를 사용하려면 :

.hide { display: none; } 

<th class="hide"> 

당신이 class 또는 style이 모두 <th>에 있는지 확인하는 것이 좋습니다을하고 <td>

대응 jQuery로 가시성을 전환하려면에 클래스를 적용 할 수 있습니다. 0 및 <td> (예 : 다음 "engcol")와과 같이 .toggle()를 사용

$('.engcol').toggle();