extjs网格隐藏并显示更改宽度

时间:2014-06-02 02:31:34

标签: javascript css extjs grid

我在div中有一个extjs网格简单的东西。我通过单击按钮隐藏并显示该容器。隐藏容器后,如果我调整窗口大小,然后再显示 容器,网格的宽度为100px。我希望它能使用宽度:100%

1 个答案:

答案 0 :(得分:0)

.container{
   border:1px solid gold;
 }
.row{
   padding:20px;
}
.col4{
  width:30%;
  float:left;
  padding:20px;
  font-size:20px;
  background-color:red;
  color:#fff;
  }

 </style>
 <script>
  $(document).ready(function(){
    $(".btn").click(function(){
       $(".container .thrd-row").css("display","none");
});
 $(window).resize(function(){
     $(".container .thrd-row").removeAttr("style");
 });
});


</script>
  //use html
  <div class="container">
    <div class="row firs-row">
        <div class="col4">1</div>
        <div class="col4">1</div>
        <div class="col4">1</div>
    </div>
    <div class="row second-row">
        <div class="col4">1</div>
        <div class="col4">1</div>
        <div class="col4">1</div>
    </div>
    <div class="row thrd-row">
        <div class="col4">1</div>
        <div class="col4">1</div>
        <div class="col4">1</div>
    </div>
    <button class="btn">click hide</button>
</div>