-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_ver2.cfm
141 lines (138 loc) · 6.39 KB
/
index_ver2.cfm
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
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/dataTables.bootstrap4.min.css">
<script type="text/javascript" src="assets/js/jquery-3.2.1.min.js"></script>
</head>
<cfparam name="responsible_area" default="All">
<body>
<cfquery datasource="LocalDB" name="getCurrency">
SELECT * FROM app.cf_currency_table
</cfquery>
<div class="container">
<div class="row">
<div class="col-md-12">
<hr/>
<cfoutput>
<form method="post" class="form-horizontal" action="#cgi.script_name#" id="ExceptionForm">
<div class="form-group">
<label class="control-label col-sm-2 formLeft" for="responsible_area">Currencies:</label>
<div class="col-sm-3">
<select name="responsible_area" class="form-control" id="responsible_area" data-error="##errNm1">
<option
<cfif responsible_area eq 'All'>selected="selected"</cfif>
>All</option>
<cfloop query="getCurrency">
<option value="#currency#" <cfif #responsible_area# eq '#Currency#'>selected="selected"</cfif> >#Currency#</option>
</cfloop>
</select>
</div>
<div class="col-sm-1">
<input type="submit" name="submitButton" class="btn btn-info btn-md" id="validate" value="Submit" />
</div>
</div>
</form>
</cfoutput>
<hr/>
</div>
<div class="col-md-12">
<table class="table table-striped table-bordered table-hovered" id="displayData">
</table>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
var globalVars = {
tableConfigs: null,
tableId:$('table#displayData')
}
var main = {
register: function(){
main.UI.register.apply();
main.EVENTS.register.apply();
},
UI: {
register: function(){
main.UI.buildTable.apply();
},
buildTable: function(){
globalVars.tableConfigs = globalVars.tableId.dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'cfc/a.cfc?method=dataTable&selectdata='+$("#responsible_area").val(),
columns:
[ { title:'First Name',name:"first_name" },
{ title:'Last Name',name:"last_name" },
{ title:'IP Address',name:"ip_address" },
{ title:'Email Address',name:"email" },
{ title:'Currency',name:"currency" },
{
title: "Action",
orderable: false,
data: null,
class: "dt-head-center",
defaultContent: [
"<center>",
"<div class=\"btn-group\">",
"<button title=\"Select Detail Data\" type=\"button\" data-tag=\"pilih\" class=\"btn btn-info btn-sm\"> <i class='glyphicon glyphicon-ok'></i></button>",
"</div>",
"</center>"
].join(""),
width: "150px"
}
]
});
}
},
ROUTINES: {
register: function(){
main.ROUTINES.getSelectedRow.apply();
},
getSelectedRow: function(obj){
return {
index : $(obj).closest('tr').index(),
data: globalVars.tableId.dataTable().fnGetData($(obj).closest('tr').index())
}
}
},
EVENTS: {
register: function(){
main.EVENTS.eventButtonRow.apply();
},
eventButtonRow: function(){
globalVars.tableId
.on('preXhr.dt', function(e, setting, data) {
console.log(data);
})
.on('xhr.dt', function(e, setting, data) {
})
.on('draw.dt', function() {
main.EVENTS.gridBtnTable.apply();
});
},
gridBtnTable: function(){
var oBtn = $('button[data-tag="pilih"]');
oBtn.unbind().bind('click',function(){
var that = $(this).attr('data-tag');
if(that=='pilih'){
var data = main.ROUTINES.getSelectedRow($(this));
console.log(data); //GET POSITION ID DATA AND ALL DATA
console.log(data.data[1]); //SEPCIFIK DATA YOU CHICE
}
});
}
}
} //END MAIN
main.register.apply();
});
</script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="assets/js/dataTables.bootstrap4.min.js"></script>
</body>
</html>