|++かも日記 | v002 test | Wassr jquery | jQuery › Downloads › Plugins › csv2table | › jQchart |
nightly test- where property, test- Custom Selector+jQchrt

jquery.csv2table.js


setting.orderBy

orderBy句
例1 orderBy : [ [ '列名' ] , [ '列名' ] , ...n ]
例2 orderBy : [ [ 列番号 ] , [ 列番号 ] , ...n ]
例3 orderBy : [ [ '列名' , 'sortType' ] , [ '列名' , 'sortType' ] , ...n ]
例4 orderBy : [ [ 列番号 , 'sortType' ] , [ 列番号 , 'sortType' ] , ...n ]

[]記号の意味は省略可ではなくJavaScript配列。sortType は、'D'==DESC 降順 'A'==ASC 昇順 。sortType省略可。省略時はASC 昇順。列番号は0から始まる連番。'列名'はStringで与えるためクオート('か")で囲み、列番号はNumberであり囲まない。
読み込むCSV ./data/order1.csv

NO,名前,種類,年齢,金額
1,アイ,Monkey,10,"10,000"
2,タマ,Cat,5,"80,000"
3,チャー,Dog,12,"500,000"
4,アー,Pig,3,"50,000"
5,イー,Weasel,2,"50,000"
6,ガー,goldfish,1,"5,000"
7,ミケ,Tortoise,5,"20,000"
8,ポチ,Tiger,2,"10,000"
9,トム,Lion,2,"2,000"
10,メリー,Dog,5,"100,000"
11,トト,Salmon,2,"70,000"
12,ポンタ,Racoon,2,"80,000

列番号(0からはじまる連番)でソート (例 orderBy : [[列番号,'D']] )

*selectとの併用時は列選択後の列番号でorder指定します。

<script src="./js/jquery-.min.js" type="text/javascript"></script>
<script src="./js/jquery.-.js" type="text/javascript" charset="utf-8"></script>

<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view1').csv2table('./data/order1.csv',{
                    orderBy : [[0]]
                });"
       value="Run orderBy : [[0]]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view1').csv2table('./data/order1.csv',{
                    orderBy : [[0,'D']]
                });"
       value="Run orderBy : [[0,'D']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view1').csv2table('./data/order1.csv',{
                    orderBy : [[0,'A']]
                });"
       value="Run orderBy : [[0,'A']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view1').csv2table('./data/order1.csv',{
                    orderBy : [[1,'A']]
                });"
       value="Run orderBy : [[1,'A']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view1').csv2table('./data/order1.csv',{
                    orderBy : [[2,'A']]
                });"
       value="Run orderBy : [[2,'A']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view1').csv2table('./data/order1.csv',{
                    orderBy : [[3,'D']]
                });"
       value="Run orderBy : [[3,'D']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view1').csv2table('./data/order1.csv',{
                    orderBy : [[4,'A']]
                });"
       value="Run orderBy : [[4,'A']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view1').csv2table('./data/order1.csv',{
                    select  : [0,1,3],
                    orderBy : [[2,'D']]
                });"
       value="Run select:[[0,1,3]],orderBy:[[2,'D']]">

<div id="view1"></div>
       

列名でソート (例 orderBy : [['列名','D']] )

*selectで列選択後の列番号を気にせず列を指定できます。

<script src="./js/jquery-.min.js" type="text/javascript"></script>
<script src="./js/jquery.-.js" type="text/javascript" charset="utf-8"></script>

<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view2').csv2table('./data/order1.csv',{
                    orderBy : [['年齢']]
                });"
       value="Run orderBy : [['年齢']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view2').csv2table('./data/order1.csv',{
                    orderBy : [['年齢','D']]
                });"
       value="Run orderBy : [['年齢','D']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view2').csv2table('./data/order1.csv',{
                    select  : [0,1,3],
                    orderBy : [['年齢','A']]
                });"
       value="Run select:[[0,1,3]],orderBy:[['年齢','A']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view2').csv2table('./data/order1.csv',{
                    orderBy : [['名前','A']]
                });"
       value="Run orderBy : [['名前','A']]">
<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view2').csv2table('./data/order1.csv',{
                    orderBy : [['金額','A']]
                });"
       value="Run orderBy : [['金額','A']]">

<input disabled
       class="btn1"
       type    =  "button"
       onclick="$('#view2').csv2table('./data/order1.csv',{
                    orderBy : [['名前','A'],['金額','D']]
                });"
       value="Run orderBy : [['名前','A'],['金額','D']]">

<div id="view2"></div>
|++かも日記 | v002 test | jQuery › Downloads › Plugins › csv2table | › jQchart |