2017-07-26 20 views
0

私はwebDevelopment.を初めて使っています。これを投稿する前に、私はすべての答えを見てきましたが、誰も私のために働いていませんでした。だから、私はこの質問をしています。私はスクロールバーを取得していますが、私のテーブルヘッダーは固定されていない、これを使用して応答テーブルのヘッダを修正してください。

overflow-y:scroll; 
height:100px; 

を追加したテーブルを持っています。だから、これで誰か助けてくれますか?

<div class="col-xs-12 col-md-12 nopadding"> 
    <div class="table-responsive"> 
     <table class="table table-striped table-bordered col-xs-12 col-lg-12"> 
      <thead class="text-center text-info text-capitalize"> 
      <th class="text-center">Sr.No.</th> 
      <th class="text-center">Document</th> 
      <th class="text-center">Score</th> 
      <th class="text-center">Actions</th> 
      </thead> 
      <tr ng-repeat="file in processResumeFiles"> 
       <td class="text-center">{{ file.id}}</td> 
       <td class="view-orphan uploadResumeTableCellOverFlow"> 
        {{ file.attributes.name}} 
       </td> 
       <td class="text-center">{{file.totalScore}}</td> 
       <td class="text-center"> 
        <button class="btn btn-labeled btn-info" title="click to see" ng-disabled="!file.attributes.isUploadedDocument" data-ng-click="somemethod($index)"> 
         <i class="fa fa-eye" aria-hidden="true"></i> 
        </button> 
        <button class="btn btn-labeled btn-info" title="click to see" ng-disabled="!file.attributes.isCommitted || !file.attributes.isUploadedDocument" data-ng-click="somemethod(file.attributes.name)"> 
         <i class="fa fa-share" aria-hidden="true"></i> 
        </button> 
        <button class="btn btn-labeled btn-info" title="click to see" data-ng-click="somemethod(file.attributes.name)"> 
         <i class="fa fa-trash" aria-hidden="true"></i> 
        </button> 
        <button class="btn btn-labeled btn-info" title="click to see" ng-disabled="!file.attributes.isCommitted || !file.attributes.isUploadedDocument" data-ng-click="somemethod(file.attributes.name)"> 
         <i class="fa fa-sign-out" aria-hidden="true"></i> 
        </button> 
        <button class="btn btn-labeled btn-info" title="click to see" ng-disabled="!file.attributes.isCommitted || !isjdDeleted || !jdSelected" 
          data-ng-click="somemethod(file.attributes.name)"> 
         <i class="fa fa-check-square" aria-hidden="true"></i> 
        </button> 
       </td> 
      </tr> 
     </table> 
    </div> 
</div> 
+0

なぜそれらを修正すると思いますか?あなたができることは、table要素の代わりにtbodyに 'overflow-y:scroll;'をセットするだけですが、これは要素が 'block 'として表示されることを必要とします。 – devqon

+0

ng-repeatでは表が100以上のエントリがあるので、私はそのテーブルのスクロールバーを追加したいだけです。このため、私はヘッダーを修正する必要があります。 – ganeshk

+0

overflow-yを使用していません:tbodyのスクロール – ganeshk

答えて

0

あなたのための仕事をして、ここでjQueryプラグインがあります:fixed header table

0

あなたはこれを試すことができます。

.table-fixed thead { 
    width: 97%; 
} 
.table-fixed tbody { 
    height: 230px; 
    overflow-y: auto; 
    width: 100%; 
} 
.table-fixed thead, .table-fixed tbody, .table-fixed tr, .table-fixed td, .table-fixed th { 
    display: block; 
} 
.table-fixed tbody td, .table-fixed thead > tr> th { 
    float: left; 
    border-bottom-width: 0; 
} 
+0

申し訳ありませんが、この問題も解決しません。 – ganeshk

0

はフィドルであなたが見るこの1

table { 
    width: 100%; 
} 

thead, tbody, tr, td, th { display: block; } 

tr:after { 
    content: ' '; 
    display: block; 
    visibility: hidden; 
    clear: both; 
} 

thead th { 
    height: 30px; 
    text-align: left; 
} 

tbody { 
    height: 120px; 
    overflow-y: auto; 
} 

thead { 
    /* fallback */ 
} 


tbody td, thead th { 
    width: 19.2%; 
    float: left; 
} 

をお試しくださいhttps://jsfiddle.net/zLgzwn56/

+0

この後、列見出しがデータと整列していないため、この問題が発生しています。 – ganeshk

+0

'thead th {' 'text-align'のコメントを削除します。更新されたコードを確認してください。 –

+0

check fiddle https://jsfiddle.net/zLgzwn56/2/ –

0

まず、テーブル要素にを追加してください。

また、セマンティクスが正しいようにするには、テーブルの内容のtbodyを追加します(これはあなたの例ではありません)。

次に、overflow: auto;と高さをtbodyに追加します。例を見てください:https://codepen.io/tjvantoll/pen/JEKIu

+0

ねえ、私は.tableBodyScroll tbody { display:block; 最大高さ:300px; overflow-y:scroll; } .tableBodyScroll thead、tbody tr { display:table; 幅:100%; テーブルレイアウト:固定; }このCSSでは、問題はヘッダーが本文のcontent.cumnヘッダーと整列していることにあります。データが整列していない理由を教えてください。 – ganeshk

+0

あなたの現在のHTMLを見ずに知るのは難しいです。実際のマークアップを使用してコードを作成すれば、簡単に手助けすることができます。 – ivanji

関連する問題