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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
loadElements();
function loadElements(clicksc){
loaderPage(true)
let isObject = {};
isObject.ipoly = 1;
var dtpr = $('#data-list2').DataTable({
serverSide : true,
destroy : true,
bFilter : true,
responsive : true,
searching : true,
pagingType : 'full',
lengthMenu : [[1, 25, 50, -1], [1, 25, 50, "All"]],
pageLength : 25,
ajax : {
url: baseURL + '/jsondata/dosenlist',
type: 'POST',
// async: false,
data : function (d) {
return $.extend( {}, d, {
iparam : cryptoEncrypt(PHRASE, isObject),
});
},
dataSrc: function(response) {
if(response.code == CODE_SUCCESS){
response = cryptoDecrypt(PHRASE, response.data);
console.log(response.data.data);
return response.data.data;
}else{
return response;
}
}
},
columns: [
{ 'data': 'id_dosen', 'sClass':'','sWidth':'10px'},
{ 'data': 'nama_dosen', 'sClass':''},
{ 'data': 'nid', 'sClass':''},
{ 'data': 'fakultas', 'sClass':''},
{ 'data': 'jurusan', 'sClass':''},
{ 'data': 'jeniskelamin', 'sClass':''},
{ 'data': '', 'sClass':'text-center','sWidth':'10px'}
],
buttons: {
buttons: [
{
extend: 'colvis',
className: 'btn btn-default'
},
]
},
processing: true,
stateSave: false,
autoWidth: false,
dom: '<"datatable-header"fBl><"datatable-scroll-wrap"t><"datatable-footer"ip>',
language: {
search: '<span>Filter:</span> _INPUT_',
lengthMenu: '<span>Show:</span> _MENU_',
processing: "<div class='table-loading'><img src='../../img/loadingtwo.gif' /></div>",
paginate: { 'first': 'First', 'last': 'Last', 'next': '→', 'previous': '←' }
},
columnDefs: [
{
width: '20px',
targets: 0,
visible: true
},
{
// render: function (data, type, row){
// // var $rowData = '<img src="/distro/assets/images/placeholder.jpg" alt="" class="img-rounded img-preview showAtt" style="cursor: pointer;">';
// let isIcon = ' icon-file-download2';
// var $rowData = '<div class="thumb img-rounded img-preview showAtt" style="width: 70px;">'+
// '<img src="/distro/assets/images/placeholder.jpg" alt="" class="img-rounded img-preview showAtt">'+
// '<div class="caption-overflow">'+
// '<span>'+
// '<p class="btn showAtt bg-success-400 btn-icon btn-lg" style="font-variant: all-petite-caps;background-color: #0e0e0e33 !important;border-color: #25252591 !important;">'+
// '<i class="'+isIcon+'"></i> '
// '</p>'+
// '</span>'+
// '</div>'+
// '</div>';
// return $rowData;
// },
// visible: true,
// targets: 1,
},
{
// render: function (data, type, row){
// // console.log(row);
// var $rowData = `
// <ul class="list-condensed list-unstyled no-margin">
// <li><span class="text-semibold">Size:</span> `+row.nama_dosen+`</li>
// <li><span class="text-semibold">Format:</span> .`+row.nid+`</li>
// </ul>
// `;
// return $rowData;
// },
// visible: true,
// targets: 3,
},
{
render: function (data, type, row){
// console.log(row);
var $rowData = `
<ul class="icons-list">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-menu9"></i>
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="`+row.nama_dosen+`"><i class="icon-pencil7"></i> Edit materi</a></li>
</ul>
</li>
</ul>
`;
return $rowData;
},
visible: true,
targets: 6,
className: 'dt-center'
},
],
fnRowCallback: function(nRow, aData, iDisplayIndex, iDisplayIndexFull){
var index = iDisplayIndexFull + 1;
$('td:eq(0)', nRow).html('#'+index);
return index;
},
drawCallback: function (settings) {
// console.log(settings.json);
var api = this.api();
var rows = api.rows({page:'current'}).nodes();
var last = null;
// console.log(rows)
// Reverse last 3 dropdowns orientation
$(this).find('tbody tr').slice(-3).find('.dropdown, .btn-group').addClass('dropup');
var that = this;
var td ;
var tr ;
this.$('td').click( function () {
td = this;
});
this.$('tr').click( function () {
tr = this;
});
this.$('.showAtt').on('click', function(){
var tr = $(this).parents('tr')
var aData = dtpr.row( tr ).data();
// loadAttachments(aData);
});
},
fnInitComplete: function (oSettings, json) {
var that = this;
var td ;
var tr ;
this.$('td').click( function () {
td = this;
});
this.$('tr').click( function () {
tr = this;
});
$('#data-list2 input').bind('keyup', function (e) {
return this.value;
});
setIFrameSize();
}
});
}