list.pt
4.43 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<html metal:use-macro="load: ../base.pt">
<div metal:fill-slot="content">
<link href="/static/datatables/extensions/TableTools/css/dataTables.tableTools.min.css" rel="stylesheet">
<link href="/static/datatables/media/css/dataTables.bootstrap.css" rel="stylesheet">
<h4>Daftar Penerimaan</h4>
<hr>
<div class="container">
<!--form class="form-inline" role="form" id="frm_upload" name="frm_upload">
<label for="upload" class="control-label">Upload:</label>
<input type="text" class="form-control" id="upload">
<button type="submit" class="btn btn-default">Upload</button>
</form-->
</div>
<p>
<table id="table1" name="table1" class="table table-bordered table-hover table-condensed" >
<thead>
<tr>
<th>ID</th>
<th>Kode</th>
<th>Subjek</th>
<th>Objek</th>
<th>Uraian</th>
<th>Rekening</th>
<!--th>Pokok</th>
<th>Denda</th>
<th>Bunga</th-->
<th>Jumlah</th>
<th>Tgl. Bayar</th>
<th>Pilih</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script src="/static/datatables/media/js/jquery.dataTables.min.js"></script>
<!--script src="/static/datatables/media/js/jquery.jeditable.js')}"></script-->
<script src="/static/datatables/media/js/jquery.dataTables.ext.js"></script>
<script src="/static/datatables/extensions/TableTools/media/js/ZeroClipboard.js"></script>
<script src="/static/datatables/media/js/dataTables.bootstrap.js"></script>
<script>
var mID;
var oTable;
var iPos;
/**
var oFormUrl = "/arstsitem/";
var oTableUrl = oFormUrl+"sspd/act";
Setelah dicoba dengan variable ini berhasil, kenapa ya?. seharusnya tidak error juga pake variable yang sebelumnya, untuk sementara pake yang ini dulu*/
var oFormUrl = "/arstsitem/";
var oTableUrl = oFormUrl+"sspd/act";
$(document).ready(function () {
oTable = $('#table1').dataTable({
"sAjaxSource" : oTableUrl,
"bServerSide" : true,
"bProcessing" : true,
"sDom" : '<"toolbar">lfrtip',
"bScrollCollapse" : true,
"bSort" : true,
"bInfo" : false,
"bFilter" : true,
"bAutoWidth" : false,
"bPaginate" : true,
"sPaginationType" : "full_numbers",
"lengthMenu": [
[10, 25, 50, -1],
[10, 25, 50, "All"]
],
"aoColumnDefs": [
{"bSearchable": false, "bVisible": false, "aTargets": [0]}
],
"aoColumns": [
null,
{"sWidth": "100px", "sClass": "left"},
{"sWidth": "30px", "sClass": "center"},
{"sWidth": "30px", "sClass": "center"},
null,
null,
{"sWidth": "75px", "sClass": "right"},
{"sWidth": "50px", "sClass": "center"},
{"sWidth": "50px", "sClass": "center"},
],
});
var tb_array = [
'<div class="btn-group pull-left">',
' <button id="btn_close" class="btn btn btn-primary" type="button">Kembali</button>',
' <button id="btn_semua" class="btn btn btn-primary pull-left" type="button">Semua</button>',
' <button id="btn_tambah" class="btn btn btn-primary pull-left" type="button">Terpilih</button>',
' ',
'</div>',
];
var tb = tb_array.join(' ');
$("div.toolbar").html(tb);
$('#table1 tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
mID = '';
$(this).removeClass('selected');
} else {
iPos = oTable.fnGetPosition(this);
var aData = oTable.fnGetData(iPos);
mID = aData[0];
oTable.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
});
$('#btn_semua').click(function () {
if (confirm('Tambah semua ke STS?')==true) {
window.location = oFormUrl+'all/add';
}
});
$('#btn_tambah').click(function () {
if (mID) {
window.location = oFormUrl+mID+'/add';
} else {
alert('Silahkan pilih data yang akan ditambahkan');
}
});
$('#btn_close').click(function () {
window.location = oFormUrl+'balik/add';
});
});
</script>
</div>
</html>