001.
002.
003.
004.
005.
function
InitialDataTable(tableName) {
006.
var
this_selected = [];
007.
$(
function
() {
008.
var
objTable = $(
'#'
+ tableName).DataTable({
009.
responsive:
false
,
010.
lengthChange:
false
,
011.
searching:
true
,
012.
bProcessing:
true
,
013.
bFilter:
false
,
014.
pagingType:
"full_numbers"
,
015.
autoWidth:
true
,
016.
bServerSide:
true
,
017.
sAjaxSource:
'../WL_WSLookupFA.asmx/getFAMAS_H0'
,
018.
sServerMethod:
'post'
,
019.
stateSave:
false
,
020.
"columnDefs"
: [
021.
{
022.
"targets"
: [5],
023.
"searchable"
:
false
,
024.
"sortable"
:
false
,
025.
"className"
:
"dtCell_center"
,
026.
"render"
:
function
(data, type, row) {
027.
return
'<input type="checkbox" class="checkboxes" value="'
+ data +
'" />'
;
028.
}
029.
}
030.
],
031.
"fnInitComplete"
:
function
(oSettings, json) {
032.
$(
'.dataTables_filter'
).hide();
033.
},
034.
"rowCallback"
:
function
(row, data) {
035.
if
($.inArray(data[5], this_selected) !== -1) {
036.
037.
$(row).addClass(
'selected'
);
038.
}
039.
},
040.
"fnCreatedRow"
:
function
(nRow, aData, iDataIndex) {
041.
$(nRow).attr(
'id'
, aData[5]);
042.
},
043.
"fnDrawCallback"
:
function
() {
044.
if
(
this
.fnSettings() !==
null
) {
045.
if
(Math.ceil((
this
.fnSettings().fnRecordsDisplay()) /
this
.fnSettings()._iDisplayLength) > 1) {
046.
$(
'.dataTables_paginate'
).css(
"display"
,
"block"
);
047.
048.
049.
}
else
{
050.
$(
'.dataTables_paginate'
).css(
"display"
,
"none"
);
051.
052.
053.
}
054.
}
055.
}
056.
});
057.
058.
059.
060.
061.
062.
063.
064.
065.
function
search(force) {
066.
var
objSearch = $(
'#ctl00_cphDetailOne_dynIC_A1_02_bsT1_txtSearch'
);
067.
068.
069.
070.
var
strSearch = $(
'#ctl00_cphDetailOne_dynIC_A1_02_bsT1_txtSearch'
).val();
071.
if
(!force && strSearch.length < 2)
return
;
072.
objTable.search(strSearch).draw();
073.
074.
075.
}
076.
$(document).on(
'keyup'
,
'#ctl00_cphDetailOne_dynIC_A1_02_bsT1_txtSearchXXX'
,
function
(event) {
077.
clearTimeout($.data(
this
,
'timer'
));
078.
if
(event.keyCode == 13 || event.which == 13) {
079.
search(
true
);
080.
}
else
{
081.
$(
this
).data(
'timer'
, setTimeout(search, 3000));
082.
}
083.
});
084.
$(document).on(
'click'
,
'#ctl00_cphDetailOne_dynIC_A1_02_bsT1_ButtonSearchStd'
,
function
(event) {
085.
086.
087.
var
objSearch = $(
'#ctl00_cphDetailOne_dynIC_A1_02_bsT1_txtSearch'
);
088.
089.
090.
var
strSearch = objSearch.val();
091.
objTable.search(strSearch).draw();
092.
093.
});
094.
095.
096.
097.
098.
099.
100.
101.
102.
103.
104.
105.
$(
"#"
+ tableName +
" thead tr th"
).resizable({
106.
handles:
'e'
107.
});
108.
109.
$(document).on(
"dblclick"
,
"#"
+ tableName +
" tbody tr"
,
function
() {
110.
111.
112.
113.
var
ref = $(
this
).find(
'td:eq(0)'
).text();
114.
if
(ref) {
115.
showMessageBox(ref);
116.
}
117.
});
118.
119.
120.
$(
'#'
+ tableName +
' tbody'
).on(
'click'
,
'tr'
,
function
() {
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
this_selected.length = 0;
134.
135.
136.
137.
138.
139.
objTable.$(
'tr.selected'
).removeClass(
'selected'
);
140.
141.
this_selected.push(
this
.id);
142.
143.
144.
145.
$(
this
).toggleClass(
'selected'
);
146.
});
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
});
159.
}
160.
161.
162.
163.
164.
165.
166.
function
InitialGridView() {
167.
168.
var
grdRowselected;
169.
$(document).on(
'mouseover mouseleave'
,
".GridView tr:not([class=PagerStyle]):not(:first-child)"
,
function
(event) {
170.
if
(event.type ==
'mouseover'
) {
171.
$(
this
).addClass(
"highlightRow"
);
172.
}
else
{
173.
$(
this
).removeClass(
"highlightRow"
);
174.
}
175.
});