• forked:神奈川県の鰻屋検索アプリ
Import an externally hosted application
Check style

  • JavaScript
  • CSS
  • HTML
  • Images
  • Input Data
  • ReadMe
  • forked:神奈川県の鰻屋検索アプリ
  • https://cdn.datatables.net/s/zf-5.5.2/jqc-1.11.3,dt-1.10.10/datatables.min.js  
  •  
  • history

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
 
var LV = LV || {};
// ※テーブルの項目名とプロパティの対応の設定
LV.property = [
    ["名称", "http://xmlns.com/foaf/0.1/firstName"],
    ["住所", "http://schema.org/address"],
    ["緯度", "http://www.w3.org/2003/01/geo/wgs84_pos#lat"],
    ["経度", "http://www.w3.org/2003/01/geo/wgs84_pos#long"], 
    
    
]
window.onload = function() {
    $("#result").append("<table class='display' id='data_list'></table>" );
    var colList=[];
    $('#data_list').dataTable({
        "aoColumns": setColName(colList),
        "asSorting": [[0,"desc"]],
        "bJQueryUI": true,
        "bAutoWidth": false,
        "bJQueryUI": true,
        
        /* 空の値が来たらハイフン表示(alert対策) */
        "columnDefs": [{
             "defaultContent": "-",
            "targets": "_all"
        }],
        /* 日本語化 */
        "language": {
            "emptyTable" : "データが登録されていません。",
            "info" : "_TOTAL_ 件中 _START_ 件から _END_ 件までを表示",
            "infoEmpty" : "",
            "infoFiltered" : "(_MAX_ 件からの絞り込み表示)",
            "infoPostFix" : "",
            "thousands" : ",",
            "lengthMenu" : "1ページあたりの表示件数: _MENU_",
            "loadingRecords" : "ロード中",
            "processing" : "処理中...",
            "search" : "検索:",
            "zeroRecords" : "該当するデータが見つかりませんでした。",
            "paginate" : {
                "first" : "先頭",
                "previous" : "前へ",
                "next" : "次へ",
                "last" : "末尾"
            }
        }
 
    });
    
    /* LinkDataからデータを取得 */
    $.each(LinkData.getWorks(), function(workKey, workValue) {
        var propList = stringToUri(LV.property, workValue);
        $.each(LinkData.getFiles(workValue), function(fileKey, fileValue) {
            $.each(LinkData.getSubjects(workValue, fileValue), function(subjKey, subjValue) {
                var dataList = [];
                
                /* その他の列のデータを取得 */
                $.each( LinkData.getProperties(workValue, fileValue), function(propKey, propValue) {
                    $.each (propList, function(i, propUri){
                        if (propUri == propValue) {
                            var objList = [];
                            $.each( LinkData.getObjects(workValue, fileValue, subjValue, propValue), function(objkey, objValue) {
                                objList.push(objValue);
                            });
                            dataList[i] = objList.toString();
                        }
                    });
                });
                /* テーブルにデータを追加 */
                $('#data_list').dataTable().fnAddData(dataList);
            });
        });
    });
}
/* プロパティがリテラルで指定された場合にURIに変換 */
function stringToUri (p, workId) {
    var arr = [];
    $.each (p, function(){
        if(this[1].indexOf("http") != 0){
            arr.push("http://linkdata.org/property/" + workId + "#" + encodeURIComponent(this[1]));
        } else {
            arr.push(this[1]);
        }
    })
    return arr;
}
/* カラム名を設定 */
function setColName(arr) {
    $.each(LV.property, function(){
        var col = {};
        col.sTitle = this[0];
        arr.push(col);
    })
    return arr;
}
 
https://cdn.datatables.net/s/zf-5.5.2/jqc-1.11.3,dt-1.10.10/datatables.min.js
Playing...

https://cdn.datatables.net/s/zf-5.5.2/jqc-1.11.3,dt-1.10.10/datatables.min.js