2016-10-20 10 views
0

次のコードを使用して、並べ替え可能なヘッダー付き垂直テーブルに取り組んでいます。列は垂直ですが、ヘッダーをクリックするとどのように並べ替えることができます。垂直ヘッダー付きテーブル(ソート可能)

CSSコード:

<style> 
#tabs{ 

} 

enter image description here

#vartabs .ui-widget-header { 
    background-color: white; 
    background-image: none; 
    border-top: none; 
    border-right: none; 
    border-left: none; 
} 

#vartabs .ui-widget-content { 
    background-color: white; 
    background-image: none; 

} 

#vartabs .ui-corner-top,#tabs .ui-corner-bottom,#tabs .ui-corner-all{ 
    border-top-left-radius: 0px; 
    border-top-right-radius: 0px; 
    border-bottom-left-radius: 0px; 
    border-bottom-right-radius: 0px; 
} 



#vartabs .ui-state-default, 
#vartabs .ui-state-default a { 
    background-color: white; 
    text-align: center; 
} 

#vartabs .ui-state-default a { 
    width: herepx; 
} 


#vartabs .ui-tabs-active, 
#vartabs .ui-tabs-active a { 
    background-color: darkgray; 
    text-align: center; 

} 

</style> 


<style> 
    th.rotate { 
    /* Something you can count on */ 
    height: 140px; 
    white-space: nowrap; 
} 

th.rotate > div { 
    transform: 
    /* Magic Numbers */ 
    translate(0px, 51px) 
    /* 45 is really 360 - 45 */ 
    rotate(270deg); 
    width: 8px; 
} 
th.rotate > div > span { 
    border-bottom: 1px solid #ccc; 
    padding: 5px 10px; 
} 


table tbody 
{ 
    overflow: auto; 
    height: 10px; 
} 



.scroll { 
    max-height: 700px; 
    overflow: auto; 
} 
th 
{ 
    width: 72px; 
} 


</style> 

私はテーブルをソートするためのネット上の別のコードを見つけましたが、そのロジックが少し異なっているとして、コードにマージする少し難しいです。

+0

ちょうど起業しているようですね。このjQueryプラグインのように、棚から何かを使う方が良いかもしれませんか? http://tablesorter.com/docs/ – SomeGuy

+0

これは縦の列ではありません。 –

+0

リンク先のプラグインには、縦の列があります。おそらく編集し、あなたのテーブルのスクリーンショットを投稿に追加しますか? – SomeGuy

答えて

0

テーブルをHTMLとCSSだけで並べ替えることはできません。 JavaScriptを使用してクライアント上で行うか、ページを生成するために使用しているプログラミング言語を使用してサーバー側で行う必要があります。

+0

私は知っているが、実際の例は確かに私を助けてくれます。 –

+0

Googleの検索結果は非常に良好です:http://tablesorter.com/docs/#Demo – elektronik

関連する問題