Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zui
提交
787b6a6e
Z
zui
项目概览
易企天创
/
zui
11 个月 前同步成功
通知
6
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
37
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
37
Issue
37
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
787b6a6e
编写于
11月 25, 2014
作者:
C
Catouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* fixed refreshSize of datatable with option mergeRows.
上级
fa320a3e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
7 addition
and
5 deletion
+7
-5
dist/lib/datatable/zui.datatable.js
dist/lib/datatable/zui.datatable.js
+3
-2
dist/lib/datatable/zui.datatable.min.js
dist/lib/datatable/zui.datatable.min.js
+1
-1
src/js/datatable.js
src/js/datatable.js
+3
-2
未找到文件。
dist/lib/datatable/zui.datatable.js
浏览文件 @
787b6a6e
...
...
@@ -945,11 +945,12 @@
var
findMaxHeight
=
function
(
$cells
)
{
var
mx
=
0
;
var
mx
=
0
,
$cell
;
$cells
.
css
(
'
height
'
,
'
auto
'
);
$cells
.
each
(
function
()
{
mx
=
Math
.
max
(
mx
,
$
(
this
).
height
());
$cell
=
$
(
this
);
if
(
!
$cell
.
attr
(
'
rowspan
'
))
mx
=
Math
.
max
(
mx
,
$cell
.
height
());
});
return
mx
;
},
...
...
dist/lib/datatable/zui.datatable.min.js
浏览文件 @
787b6a6e
...
...
@@ -5,4 +5,4 @@
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
*/
!
function
(
a
){
"
use strict
"
;
var
b
=
"
zui.datatable
"
,
c
=
function
(
c
,
d
){
this
.
name
=
b
,
this
.
$
=
a
(
c
),
this
.
isTable
=
"
TABLE
"
===
this
.
$
[
0
].
tagName
,
this
.
firstShow
=!
0
,
this
.
isTable
?(
this
.
$table
=
this
.
$
,
this
.
id
=
"
datatable-
"
+
(
this
.
$
.
attr
(
"
id
"
)
||
a
.
uuid
())):(
this
.
$datatable
=
this
.
$
.
addClass
(
"
datatable
"
),
this
.
$
.
attr
(
"
id
"
)?
this
.
id
=
this
.
$
.
attr
(
"
id
"
):(
this
.
id
=
"
datatable-
"
+
a
.
uuid
(),
this
.
$
.
attr
(
"
id
"
,
this
.
id
))),
this
.
getOptions
(
d
),
this
.
load
(),
this
.
callEvent
(
"
ready
"
)};
c
.
DEFAULTS
=
{
checkable
:
!
1
,
checkByClickRow
:
!
0
,
checkedClass
:
"
active
"
,
checkboxName
:
null
,
sortable
:
!
1
,
storage
:
!
0
,
fixedHeader
:
!
0
,
fixedHeaderOffset
:
0
,
fixedLeftWidth
:
"
30%
"
,
fixedRightWidth
:
"
30%
"
,
flexHeadDrag
:
!
0
,
scrollPos
:
"
in
"
,
rowHover
:
!
0
,
colHover
:
!
0
,
hoverClass
:
"
hover
"
,
colHoverClass
:
"
col-hover
"
,
mergeRows
:
!
1
,
minColWidth
:
20
,
minFixedLeftWidth
:
200
,
minFixedRightWidth
:
200
,
minFlexAreaWidth
:
200
},
c
.
prototype
.
getOptions
=
function
(
b
){
var
d
=
this
.
$
;
b
=
a
.
extend
({},
c
.
DEFAULTS
,
this
.
$
.
data
(),
b
),
b
.
tableClass
=
b
.
tableClass
||
""
,
b
.
tableClass
=
"
"
+
b
.
tableClass
+
"
table-datatable
"
,
a
.
each
([
"
bordered
"
,
"
condensed
"
,
"
striped
"
,
"
condensed
"
,
"
fixed
"
],
function
(
a
,
c
){
c
=
"
table-
"
+
c
,
d
.
hasClass
(
c
)
&&
(
b
.
tableClass
+=
"
"
+
c
)}),(
d
.
hasClass
(
"
table-hover
"
)
||
b
.
rowHover
)
&&
(
b
.
tableClass
+=
"
table-hover
"
),
this
.
options
=
b
},
c
.
prototype
.
load
=
function
(
c
){
var
d
,
e
=
this
.
options
;
if
(
a
.
isPlainObject
(
c
))
this
.
data
=
c
;
else
if
(
"
string
"
==
typeof
c
){
var
f
=
a
(
c
);
f
.
length
&&
(
this
.
$table
=
f
.
first
(),
this
.
$table
.
data
(
b
,
this
),
this
.
isTable
=!
0
),
c
=
null
}
else
c
=
e
.
data
;
if
(
!
c
){
if
(
!
this
.
isTable
)
throw
new
Error
(
"
No data avaliable!
"
);
c
=
{
cols
:[],
rows
:[]},
d
=
c
.
cols
;
var
g
,
h
,
i
,
j
,
k
=
c
.
rows
,
l
=
this
.
$table
;
l
.
find
(
"
thead > tr:first
"
).
children
(
"
th
"
).
each
(
function
(){
g
=
a
(
this
),
d
.
push
(
a
.
extend
({
text
:
g
.
html
(),
flex
:
!
1
||
g
.
hasClass
(
"
flex-col
"
),
width
:
"
auto
"
,
cssClass
:
g
.
attr
(
"
class
"
),
css
:
g
.
attr
(
"
style
"
),
type
:
"
string
"
,
ignore
:
g
.
hasClass
(
"
ignore
"
),
sort
:
!
g
.
hasClass
(
"
sort-disabled
"
),
mergeRows
:
g
.
attr
(
"
merge-rows
"
)},
g
.
data
()))}),
l
.
find
(
"
tbody > tr
"
).
each
(
function
(){
h
=
a
(
this
),
j
=
a
.
extend
({
data
:[],
checked
:
!
1
,
cssClass
:
h
.
attr
(
"
class
"
),
css
:
h
.
attr
(
"
style
"
),
id
:
h
.
attr
(
"
id
"
)},
h
.
data
()),
h
.
children
(
"
td
"
).
each
(
function
(){
i
=
a
(
this
),
j
.
data
.
push
(
a
.
extend
({
cssClass
:
i
.
attr
(
"
class
"
),
css
:
i
.
attr
(
"
style
"
),
text
:
i
.
html
()},
i
.
data
()))}),
k
.
push
(
j
)});
var
m
=
l
.
find
(
"
tfoot
"
);
m
.
length
&&
(
c
.
footer
=
a
(
'
<table class="table
'
+
e
.
tableClass
+
'
"></table>
'
).
append
(
m
))}
c
.
flexStart
=-
1
,
c
.
flexEnd
=-
1
,
d
=
c
.
cols
,
c
.
colsLength
=
d
.
length
;
for
(
var
n
=
0
;
n
<
c
.
colsLength
;
++
n
){
var
o
=
d
[
n
];
o
.
flex
&&
(
c
.
flexStart
<
0
&&
(
c
.
flexStart
=
n
),
c
.
flexEnd
=
n
)}
0
===
c
.
flexStart
&&
c
.
flexEnd
===
c
.
colsLength
&&
(
c
.
flexStart
=-
1
,
c
.
flexEnd
=-
1
),
c
.
flexArea
=
c
.
flexStart
>=
0
,
c
.
fixedRight
=
c
.
flexEnd
>=
0
&&
c
.
flexEnd
<
c
.
colsLength
-
1
,
c
.
fixedLeft
=
c
.
flexStart
>
0
,
c
.
flexStart
<
0
&&
c
.
flexEnd
<
0
&&
(
c
.
fixedLeft
=!
0
,
c
.
flexStart
=
c
.
colsLength
,
c
.
flexEnd
=
c
.
colsLength
),
this
.
data
=
c
,
this
.
callEvent
(
"
afterLoad
"
,{
data
:
c
}),
this
.
render
()},
c
.
prototype
.
render
=
function
(){
var
c
,
d
,
e
,
f
,
g
=
this
,
h
=
g
.
$datatable
||
(
g
.
isTable
?
a
(
'
<div class="datatable" id="
'
+
g
.
id
+
'
"/>
'
):
g
.
$datatable
),
i
=
g
.
options
,
j
=
g
.
data
,
k
=
g
.
data
.
cols
,
l
=
g
.
data
.
rows
,
m
=
i
.
checkable
,
n
=
'
<div class="datatable-rows-span datatable-span"><div class="datatable-wrapper"><table class="table"></table></div></div>
'
,
o
=
'
<div class="datatable-head-span datatable-span"><div class="datatable-wrapper"><table class="table"><thead></thead></table></div></div>
'
;
h
.
children
(
"
.datatable-head, .datatable-rows, .scroll-wrapper
"
).
remove
(),
h
.
toggleClass
(
"
sortable
"
,
i
.
sortable
);
var
p
,
q
,
r
,
s
=
a
(
'
<div class="datatable-head"/>
'
);
for
(
c
=
a
(
"
<tr/>
"
),
e
=
a
(
"
<tr/>
"
),
f
=
a
(
"
<tr/>
"
),
d
=
0
;
d
<
k
.
length
;
d
++
)
r
=
k
[
d
],
p
=
d
<
j
.
flexStart
?
c
:
d
>=
j
.
flexStart
&&
d
<=
j
.
flexEnd
?
f
:
e
,
0
===
d
&&
m
&&
p
.
append
(
'
<th data-index="check" class="check-all check-btn"><i class="icon-check-empty"></i></th>
'
),
r
.
ignore
||
(
q
=
a
(
"
<th/>
"
),
q
.
toggleClass
(
"
sort-down
"
,
"
down
"
===
r
.
sort
).
toggleClass
(
"
sort-up
"
,
"
up
"
===
r
.
sort
).
toggleClass
(
"
sort-disabled
"
,
r
.
sort
===!
1
),
q
.
addClass
(
r
.
cssClass
).
addClass
(
r
.
colClass
).
html
(
r
.
text
).
attr
({
"
data-index
"
:
d
,
"
data-type
"
:
r
.
type
,
style
:
r
.
css
}),
p
.
append
(
q
));
var
t
;
j
.
fixedLeft
&&
(
t
=
a
(
o
),
t
.
addClass
(
"
fixed-left
"
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
find
(
"
thead
"
).
append
(
c
),
s
.
append
(
t
)),
j
.
flexArea
&&
(
t
=
a
(
o
),
t
.
addClass
(
"
flexarea
"
).
find
(
"
.datatable-wrapper
"
).
append
(
'
<div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div>
'
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
find
(
"
thead
"
).
append
(
f
),
s
.
append
(
t
)),
j
.
fixedRight
&&
(
t
=
a
(
o
),
t
.
addClass
(
"
fixed-right
"
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
find
(
"
thead
"
).
append
(
e
),
s
.
append
(
t
)),
h
.
append
(
s
);
var
u
,
v
,
w
,
x
,
y
,
z
,
A
,
B
,
C
=
a
(
'
<div class="datatable-rows">
'
),
D
=
l
.
length
;
c
=
a
(
"
<tbody/>
"
),
e
=
a
(
"
<tbody/>
"
),
f
=
a
(
"
<tbody/>
"
);
for
(
var
E
=
0
;
D
>
E
;
++
E
){
for
(
z
=
l
[
E
],
"
undefined
"
==
typeof
z
.
id
&&
(
z
.
id
=
E
),
z
.
index
=
E
,
u
=
a
(
"
<tr/>
"
),
u
.
addClass
(
z
.
cssClass
).
toggleClass
(
i
.
checkedClass
,
z
.
checked
).
attr
({
"
data-index
"
:
E
,
"
data-id
"
:
z
.
id
}),
v
=
u
.
clone
(),
w
=
u
.
clone
(),
B
=
z
.
data
.
length
,
d
=
0
;
B
>
d
;
++
d
)
A
=
z
.
data
[
d
],
p
=
d
<
j
.
flexStart
?
u
:
d
>=
j
.
flexStart
&&
d
<=
j
.
flexEnd
?
v
:
w
,
0
===
d
&&
m
&&
(
y
=
a
(
'
<td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td>
'
),
i
.
checkboxName
&&
y
.
append
(
'
<input class="hide" type="checkbox" name="
'
+
i
.
checkboxName
+
'
" value="
'
+
z
.
id
+
'
">
'
),
p
.
append
(
y
)),
k
[
d
].
ignore
||
(
a
.
isPlainObject
(
A
)
||
(
A
=
{
text
:
A
,
row
:
E
,
index
:
d
},
z
.
data
[
d
]
=
A
),
x
=
a
(
"
<td/>
"
),
x
.
html
(
A
.
text
).
addClass
(
A
.
cssClass
).
addClass
(
k
[
d
].
colClass
).
attr
({
"
data-row
"
:
E
,
"
data-index
"
:
d
,
"
data-flex
"
:
!
1
,
"
data-type
"
:
k
[
d
].
type
,
style
:
A
.
css
}),
p
.
append
(
x
));
c
.
append
(
u
),
f
.
append
(
v
),
e
.
append
(
w
)}
var
F
;
j
.
fixedLeft
&&
(
F
=
a
(
n
),
F
.
addClass
(
"
fixed-left
"
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
append
(
c
),
C
.
append
(
F
)),
j
.
flexArea
&&
(
F
=
a
(
n
),
F
.
addClass
(
"
flexarea
"
).
find
(
"
.datatable-wrapper
"
).
append
(
'
<div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div>
'
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
append
(
f
),
C
.
append
(
F
)),
j
.
fixedRight
&&
(
F
=
a
(
n
),
F
.
addClass
(
"
fixed-right
"
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
append
(
e
),
C
.
append
(
F
)),
h
.
append
(
C
),
j
.
flexArea
&&
h
.
append
(
'
<div class="scroll-wrapper"><div class="scroll-slide scroll-pos-
'
+
i
.
scrollPos
+
'
"><div class="bar"></div></div></div>
'
);
var
G
=
h
.
children
(
"
.datatable-footer
"
).
detach
();
j
.
footer
?(
h
.
append
(
a
(
'
<div class="datatable-footer"/>
'
).
append
(
j
.
footer
)),
j
.
footer
=
null
):
G
.
length
&&
h
.
append
(
G
),
g
.
$datatable
=
h
.
data
(
b
,
g
),
g
.
isTable
&&
g
.
firstShow
&&
(
g
.
$table
.
attr
(
"
data-datatable-id
"
,
this
.
id
).
hide
().
after
(
h
),
g
.
firstShow
=!
1
),
g
.
bindEvents
(),
g
.
refreshSize
(),
g
.
callEvent
(
"
render
"
)},
c
.
prototype
.
bindEvents
=
function
(){
var
b
=
this
,
c
=
this
.
data
,
d
=
this
.
options
,
e
=
window
.
store
,
f
=
this
.
$datatable
,
g
=
b
.
$dataSpans
=
f
.
children
(
"
.datatable-head, .datatable-rows
"
).
find
(
"
.datatable-span
"
),
h
=
b
.
$rowsSpans
=
f
.
children
(
"
.datatable-rows
"
).
children
(
"
.datatable-rows-span
"
),
i
=
b
.
$headSpans
=
f
.
children
(
"
.datatable-head
"
).
children
(
"
.datatable-head-span
"
),
j
=
b
.
$cells
=
g
.
find
(
"
td, th
"
),
k
=
b
.
$dataCells
=
j
.
filter
(
"
td
"
);
b
.
$headCells
=
j
.
filter
(
"
th
"
);
var
l
=
b
.
$rows
=
b
.
$rowsSpans
.
find
(
"
.table > tbody > tr
"
);
if
(
d
.
rowHover
){
var
m
=
d
.
hoverClass
;
h
.
on
(
"
mouseenter
"
,
"
td
"
,
function
(){
k
.
filter
(
"
.
"
+
m
).
removeClass
(
m
),
l
.
filter
(
"
.
"
+
m
).
removeClass
(
m
),
l
.
filter
(
'
[data-index="
'
+
a
(
this
).
addClass
(
m
).
closest
(
"
tr
"
).
data
(
"
index
"
)
+
'
"]
'
).
addClass
(
m
)}).
on
(
"
mouseleave
"
,
"
td
"
,
function
(){
k
.
filter
(
"
.
"
+
m
).
removeClass
(
m
),
l
.
filter
(
"
.
"
+
m
).
removeClass
(
m
)})}
if
(
d
.
colHover
){
var
n
=
d
.
colHoverClass
;
i
.
on
(
"
mouseenter
"
,
"
th
"
,
function
(){
j
.
filter
(
"
.
"
+
n
).
removeClass
(
n
),
j
.
filter
(
'
[data-index="
'
+
a
(
this
).
data
(
"
index
"
)
+
'
"]
'
).
addClass
(
n
)}).
on
(
"
mouseleave
"
,
"
th
"
,
function
(){
j
.
filter
(
"
.
"
+
n
).
removeClass
(
n
)})}
if
(
c
.
flexArea
){
var
o
,
p
,
q
,
r
,
s
,
t
,
u
,
v
=
f
.
find
(
"
.scroll-slide
"
),
w
=
f
.
find
(
"
.datatable-span.flexarea
"
),
x
=
f
.
find
(
"
.datatable-span.fixed-left
"
),
y
=
f
.
find
(
"
.datatable-span.flexarea .table
"
),
z
=
v
.
children
(
"
.bar
"
),
A
=
b
.
id
+
"
_scrollOffset
"
;
b
.
width
=
f
.
width
(),
f
.
resize
(
function
(){
b
.
width
=
f
.
width
()});
var
B
=
function
(
a
,
b
){
s
=
Math
.
max
(
0
,
Math
.
min
(
o
-
p
,
a
)),
b
||
f
.
addClass
(
"
scrolling
"
),
z
.
css
(
"
left
"
,
s
),
u
=
0
-
Math
.
floor
((
q
-
o
)
*
s
/
(
o
-
p
)),
y
.
css
(
"
left
"
,
u
),
r
=
s
,
f
.
toggleClass
(
"
scrolled-in
"
,
s
>
2
).
toggleClass
(
"
scrolled-out
"
,
o
-
p
-
2
>
s
),
d
.
storage
&&
e
.
pageSet
(
A
,
s
)},
C
=
function
(){
o
=
w
.
width
(),
v
.
width
(
o
).
css
(
"
left
"
,
x
.
width
()),
q
=
y
.
width
(),
p
=
Math
.
floor
(
o
*
o
/
q
),
z
.
css
(
"
width
"
,
p
),
y
.
css
(
"
min-width
"
,
o
),
f
.
toggleClass
(
"
show-scroll-slide
"
,
q
>
o
),
t
||
o
===
p
||
(
t
=!
0
,
B
(
e
.
pageGet
(
A
,
0
),
!
0
)),
f
.
hasClass
(
"
size-changing
"
)
&&
B
(
s
,
!
0
)};
w
.
resize
(
C
),
d
.
storage
&&
C
();
var
D
=
{
move
:
!
1
,
stopPropagation
:
!
0
,
drag
:
function
(
a
){
B
(
z
.
position
().
left
+
a
.
smallOffset
.
x
*
(
a
.
element
.
hasClass
(
"
bar
"
)?
1
:
-
1
))},
finish
:
function
(){
f
.
removeClass
(
"
scrolling
"
)}};
z
.
draggable
(
D
),
d
.
flexHeadDrag
&&
f
.
find
(
"
.datatable-head-span.flexarea
"
).
draggable
(
D
),
v
.
mousedown
(
function
(
a
){
var
b
=
a
.
pageX
-
v
.
offset
().
left
;
B
(
b
-
p
/
2
)})}
if
(
d
.
checkable
){
var
E
,
F
=
b
.
id
+
"
_checkedStatus
"
,
G
=
d
.
checkedClass
,
H
=
function
(){
var
f
=
h
.
first
().
find
(
"
.table > tbody > tr
"
),
g
=
f
.
filter
(
"
.
"
+
G
);
f
.
find
(
"
.check-row input:checkbox
"
).
prop
(
"
checked
"
,
!
1
);
var
j
=
{
checkedAll
:
f
.
length
===
g
.
length
&&
g
.
length
>
0
,
checks
:
g
.
map
(
function
(){
return
E
=
a
(
this
).
data
(
"
id
"
),
d
.
checkboxName
&&
a
(
this
).
find
(
"
.check-row input:checkbox
"
).
prop
(
"
checked
"
,
!
0
),
E
}).
toArray
()};
a
.
each
(
c
.
rows
,
function
(
b
,
c
){
c
.
checked
=
a
.
inArray
(
c
.
id
,
j
.
checks
)
>-
1
}),
i
.
find
(
"
.check-all
"
).
toggleClass
(
"
checked
"
,
j
.
checkedAll
),
d
.
storage
&&
e
.
pageSet
(
F
,
j
),
b
.
callEvent
(
"
checksChanged
"
,{
checks
:
j
})};
this
.
$rowsSpans
.
on
(
"
click
"
,
d
.
checkByClickRow
?
"
tr
"
:
"
.check-row
"
,
function
(){
l
.
filter
(
'
[data-index="
'
+
a
(
this
).
closest
(
"
tr
"
).
data
(
"
index
"
)
+
'
"]
'
).
toggleClass
(
G
),
H
()});
var
I
=
"
click.zui.datatable.check-all
"
;
if
(
this
.
$datatable
.
off
(
I
).
on
(
I
,
"
.check-all
"
,
function
(){
l
.
toggleClass
(
G
,
a
(
this
).
toggleClass
(
"
checked
"
).
hasClass
(
"
checked
"
)),
H
()}).
on
(
"
click
"
,
"
.check-none
"
,
function
(){
l
.
toggleClass
(
G
,
!
1
),
H
()}).
on
(
"
click
"
,
"
.check-inverse
"
,
function
(){
l
.
toggleClass
(
G
),
H
()}),
d
.
storage
){
var
J
=
e
.
pageGet
(
F
);
J
&&
(
i
.
find
(
"
.check-all
"
).
toggleClass
(
"
checked
"
,
J
.
checkedAll
),
J
.
checkedAll
?
l
.
addClass
(
G
):(
l
.
removeClass
(
G
),
a
.
each
(
J
.
checks
,
function
(
a
,
b
){
l
.
filter
(
'
[data-id="
'
+
b
+
'
"]
'
).
addClass
(
G
)})),
J
.
checks
.
length
&&
H
())}}
if
(
d
.
fixedHeader
){
var
K
,
L
,
M
,
N
=
f
.
children
(
"
.datatable-head
"
),
O
=
d
.
fixedHeaderOffset
||
a
(
"
.navbar.navbar-fixed-top
"
).
height
()
||
0
,
P
=
function
(){
K
=
f
.
offset
().
top
,
M
=
a
(
window
).
scrollTop
(),
L
=
f
.
height
(),
f
.
toggleClass
(
"
head-fixed
"
,
M
+
O
>
K
&&
K
+
L
>
M
+
O
),
f
.
hasClass
(
"
head-fixed
"
)?
N
.
css
({
width
:
f
.
width
(),
top
:
O
}):
N
.
attr
(
"
style
"
,
""
)};
a
(
window
).
scroll
(
P
),
P
()}
d
.
sortable
?(
i
.
on
(
"
click
"
,
"
th:not(.sort-disabled, .check-btn)
"
,
function
(){
f
.
hasClass
(
"
size-changing
"
)
||
b
.
sortTable
(
a
(
this
))}),
d
.
storage
&&
b
.
sortTable
()):
d
.
mergeRows
&&
this
.
mergeRows
()},
c
.
prototype
.
mergeRows
=
function
(){
for
(
var
b
=
this
.
$rowsSpans
.
find
(
"
.table > tbody > tr > td
"
),
c
=
this
.
data
.
cols
,
d
=
0
;
d
<
c
.
length
;
d
++
){
var
e
=
c
[
d
];
if
(
e
.
mergeRows
){
var
f
=
b
.
filter
(
'
[data-index="
'
+
d
+
'
"]
'
);
if
(
f
.
length
>
1
){
var
g
;
f
.
each
(
function
(){
var
b
=
a
(
this
);
g
&&
b
.
html
()
===
g
.
html
()?(
g
.
attr
(
"
rowspan
"
,(
g
.
attr
(
"
rowspan
"
)
||
1
)
+
1
).
css
(
"
vertical-align
"
,
"
middle
"
),
b
.
remove
()):
g
=
b
})}}}},
c
.
prototype
.
sortTable
=
function
(
b
){
var
c
=
window
.
store
,
d
=
this
.
options
,
e
=
this
.
id
+
"
_datatableSorter
"
,
f
=
d
.
storage
?
c
.
pageGet
(
e
):
null
;
if
(
b
||
(
b
=
f
?
this
.
$headCells
.
filter
(
'
[data-index="
'
+
f
.
index
+
'
"]
'
).
addClass
(
"
sort-
"
+
f
.
type
):
this
.
$headCells
.
filter
(
"
.sort-up, .sort-down
"
).
first
()),
b
.
length
){
var
g
,
h
,
i
,
j
=
this
.
data
,
k
=
j
.
cols
,
l
=
j
.
rows
,
m
=
this
.
$headCells
;
g
=!
b
.
hasClass
(
"
sort-up
"
),
m
.
removeClass
(
"
sort-up sort-down
"
),
b
.
addClass
(
g
?
"
sort-up
"
:
"
sort-down
"
),
i
=
b
.
data
(
"
index
"
),
g
=
b
.
hasClass
(
"
sort-up
"
),
a
.
each
(
k
,
function
(
a
,
b
){
a
==
i
||
"
up
"
!==
b
.
sort
&&
"
down
"
!==
b
.
sort
?
a
==
i
&&
(
b
.
sort
=
g
?
"
up
"
:
"
down
"
,
h
=
b
.
type
):
b
.
sort
=!
0
});
var
n
,
o
,
p
,
q
=
this
.
$dataCells
.
filter
(
'
[data-index="
'
+
i
+
'
"]
'
);
l
.
sort
(
function
(
a
,
b
){
return
a
=
a
.
data
[
i
],
b
=
b
.
data
[
i
],
n
=
q
.
filter
(
'
[data-row="
'
+
a
.
row
+
'
"]
'
).
text
(),
o
=
q
.
filter
(
'
[data-row="
'
+
b
.
row
+
'
"]
'
).
text
(),
"
number
"
===
h
?(
n
=
parseFloat
(
n
),
o
=
parseFloat
(
o
)):
"
date
"
===
h
?(
n
=
Date
.
parse
(
n
),
o
=
Date
.
parse
(
o
)):(
n
=
n
.
toLowerCase
(),
o
=
o
.
toLowerCase
()),
p
=
n
>
o
?
1
:
o
>
n
?
-
1
:
0
,
g
&&
(
p
=-
1
*
p
),
p
});
var
r
,
s
,
t
,
u
=
this
.
$rows
,
v
=
[];
a
.
each
(
l
,
function
(
b
,
c
){
r
=
u
.
filter
(
'
[data-index="
'
+
c
.
index
+
'
"]
'
),
r
.
each
(
function
(
b
){
t
=
a
(
this
),
s
=
v
[
b
],
s
?
s
.
after
(
t
):
t
.
parent
().
prepend
(
t
),
v
[
b
]
=
t
})}),
f
=
{
index
:
i
,
type
:
g
?
"
up
"
:
"
down
"
},
d
.
storage
&&
c
.
pageSet
(
e
,
f
),
this
.
callEvent
(
"
sort
"
,{
sorter
:
f
})}},
c
.
prototype
.
refreshSize
=
function
(){
var
b
,
c
=
this
.
$datatable
,
d
=
this
.
options
,
e
=
this
.
data
.
rows
,
f
=
this
.
data
.
cols
;
c
.
find
(
"
.datatable-span.fixed-left
"
).
css
(
"
width
"
,
d
.
fixedLeftWidth
),
c
.
find
(
"
.datatable-span.fixed-right
"
).
css
(
"
width
"
,
d
.
fixedRightWidth
);
var
g
=
function
(
b
){
var
c
=
0
;
return
b
.
css
(
"
height
"
,
"
auto
"
),
b
.
each
(
function
(){
c
=
Math
.
max
(
c
,
a
(
this
).
height
())}),
c
},
h
=
this
.
$dataCells
,
i
=
this
.
$cells
,
j
=
this
.
$headCells
;
for
(
b
=
0
;
b
<
f
.
length
;
++
b
)
i
.
filter
(
'
[data-index="
'
+
b
+
'
"]
'
).
css
(
"
width
"
,
f
[
b
].
width
);
j
.
height
(
g
(
j
));
var
k
;
for
(
b
=
0
;
b
<
e
.
length
;
++
b
)
k
=
h
.
filter
(
'
[data-row="
'
+
b
+
'
"]
'
),
k
.
height
(
g
(
k
))},
c
.
prototype
.
callEvent
=
function
(
a
,
b
){
var
c
=
this
.
$
.
callEvent
(
a
+
"
.
"
+
this
.
name
,
b
,
this
).
result
;
return
!
(
void
0
!==
c
&&!
c
)},
a
.
fn
.
datatable
=
function
(
d
){
return
this
.
each
(
function
(){
var
e
=
a
(
this
),
f
=
e
.
data
(
b
),
g
=
"
object
"
==
typeof
d
&&
d
;
f
||
e
.
data
(
b
,
f
=
new
c
(
this
,
g
)),
"
string
"
==
typeof
d
&&
f
[
d
]()})},
a
.
fn
.
datatable
.
Constructor
=
c
}(
jQuery
);
\ No newline at end of file
!
function
(
a
){
"
use strict
"
;
var
b
=
"
zui.datatable
"
,
c
=
function
(
c
,
d
){
this
.
name
=
b
,
this
.
$
=
a
(
c
),
this
.
isTable
=
"
TABLE
"
===
this
.
$
[
0
].
tagName
,
this
.
firstShow
=!
0
,
this
.
isTable
?(
this
.
$table
=
this
.
$
,
this
.
id
=
"
datatable-
"
+
(
this
.
$
.
attr
(
"
id
"
)
||
a
.
uuid
())):(
this
.
$datatable
=
this
.
$
.
addClass
(
"
datatable
"
),
this
.
$
.
attr
(
"
id
"
)?
this
.
id
=
this
.
$
.
attr
(
"
id
"
):(
this
.
id
=
"
datatable-
"
+
a
.
uuid
(),
this
.
$
.
attr
(
"
id
"
,
this
.
id
))),
this
.
getOptions
(
d
),
this
.
load
(),
this
.
callEvent
(
"
ready
"
)};
c
.
DEFAULTS
=
{
checkable
:
!
1
,
checkByClickRow
:
!
0
,
checkedClass
:
"
active
"
,
checkboxName
:
null
,
sortable
:
!
1
,
storage
:
!
0
,
fixedHeader
:
!
0
,
fixedHeaderOffset
:
0
,
fixedLeftWidth
:
"
30%
"
,
fixedRightWidth
:
"
30%
"
,
flexHeadDrag
:
!
0
,
scrollPos
:
"
in
"
,
rowHover
:
!
0
,
colHover
:
!
0
,
hoverClass
:
"
hover
"
,
colHoverClass
:
"
col-hover
"
,
mergeRows
:
!
1
,
minColWidth
:
20
,
minFixedLeftWidth
:
200
,
minFixedRightWidth
:
200
,
minFlexAreaWidth
:
200
},
c
.
prototype
.
getOptions
=
function
(
b
){
var
d
=
this
.
$
;
b
=
a
.
extend
({},
c
.
DEFAULTS
,
this
.
$
.
data
(),
b
),
b
.
tableClass
=
b
.
tableClass
||
""
,
b
.
tableClass
=
"
"
+
b
.
tableClass
+
"
table-datatable
"
,
a
.
each
([
"
bordered
"
,
"
condensed
"
,
"
striped
"
,
"
condensed
"
,
"
fixed
"
],
function
(
a
,
c
){
c
=
"
table-
"
+
c
,
d
.
hasClass
(
c
)
&&
(
b
.
tableClass
+=
"
"
+
c
)}),(
d
.
hasClass
(
"
table-hover
"
)
||
b
.
rowHover
)
&&
(
b
.
tableClass
+=
"
table-hover
"
),
this
.
options
=
b
},
c
.
prototype
.
load
=
function
(
c
){
var
d
,
e
=
this
.
options
;
if
(
a
.
isPlainObject
(
c
))
this
.
data
=
c
;
else
if
(
"
string
"
==
typeof
c
){
var
f
=
a
(
c
);
f
.
length
&&
(
this
.
$table
=
f
.
first
(),
this
.
$table
.
data
(
b
,
this
),
this
.
isTable
=!
0
),
c
=
null
}
else
c
=
e
.
data
;
if
(
!
c
){
if
(
!
this
.
isTable
)
throw
new
Error
(
"
No data avaliable!
"
);
c
=
{
cols
:[],
rows
:[]},
d
=
c
.
cols
;
var
g
,
h
,
i
,
j
,
k
=
c
.
rows
,
l
=
this
.
$table
;
l
.
find
(
"
thead > tr:first
"
).
children
(
"
th
"
).
each
(
function
(){
g
=
a
(
this
),
d
.
push
(
a
.
extend
({
text
:
g
.
html
(),
flex
:
!
1
||
g
.
hasClass
(
"
flex-col
"
),
width
:
"
auto
"
,
cssClass
:
g
.
attr
(
"
class
"
),
css
:
g
.
attr
(
"
style
"
),
type
:
"
string
"
,
ignore
:
g
.
hasClass
(
"
ignore
"
),
sort
:
!
g
.
hasClass
(
"
sort-disabled
"
),
mergeRows
:
g
.
attr
(
"
merge-rows
"
)},
g
.
data
()))}),
l
.
find
(
"
tbody > tr
"
).
each
(
function
(){
h
=
a
(
this
),
j
=
a
.
extend
({
data
:[],
checked
:
!
1
,
cssClass
:
h
.
attr
(
"
class
"
),
css
:
h
.
attr
(
"
style
"
),
id
:
h
.
attr
(
"
id
"
)},
h
.
data
()),
h
.
children
(
"
td
"
).
each
(
function
(){
i
=
a
(
this
),
j
.
data
.
push
(
a
.
extend
({
cssClass
:
i
.
attr
(
"
class
"
),
css
:
i
.
attr
(
"
style
"
),
text
:
i
.
html
()},
i
.
data
()))}),
k
.
push
(
j
)});
var
m
=
l
.
find
(
"
tfoot
"
);
m
.
length
&&
(
c
.
footer
=
a
(
'
<table class="table
'
+
e
.
tableClass
+
'
"></table>
'
).
append
(
m
))}
c
.
flexStart
=-
1
,
c
.
flexEnd
=-
1
,
d
=
c
.
cols
,
c
.
colsLength
=
d
.
length
;
for
(
var
n
=
0
;
n
<
c
.
colsLength
;
++
n
){
var
o
=
d
[
n
];
o
.
flex
&&
(
c
.
flexStart
<
0
&&
(
c
.
flexStart
=
n
),
c
.
flexEnd
=
n
)}
0
===
c
.
flexStart
&&
c
.
flexEnd
===
c
.
colsLength
&&
(
c
.
flexStart
=-
1
,
c
.
flexEnd
=-
1
),
c
.
flexArea
=
c
.
flexStart
>=
0
,
c
.
fixedRight
=
c
.
flexEnd
>=
0
&&
c
.
flexEnd
<
c
.
colsLength
-
1
,
c
.
fixedLeft
=
c
.
flexStart
>
0
,
c
.
flexStart
<
0
&&
c
.
flexEnd
<
0
&&
(
c
.
fixedLeft
=!
0
,
c
.
flexStart
=
c
.
colsLength
,
c
.
flexEnd
=
c
.
colsLength
),
this
.
data
=
c
,
this
.
callEvent
(
"
afterLoad
"
,{
data
:
c
}),
this
.
render
()},
c
.
prototype
.
render
=
function
(){
var
c
,
d
,
e
,
f
,
g
=
this
,
h
=
g
.
$datatable
||
(
g
.
isTable
?
a
(
'
<div class="datatable" id="
'
+
g
.
id
+
'
"/>
'
):
g
.
$datatable
),
i
=
g
.
options
,
j
=
g
.
data
,
k
=
g
.
data
.
cols
,
l
=
g
.
data
.
rows
,
m
=
i
.
checkable
,
n
=
'
<div class="datatable-rows-span datatable-span"><div class="datatable-wrapper"><table class="table"></table></div></div>
'
,
o
=
'
<div class="datatable-head-span datatable-span"><div class="datatable-wrapper"><table class="table"><thead></thead></table></div></div>
'
;
h
.
children
(
"
.datatable-head, .datatable-rows, .scroll-wrapper
"
).
remove
(),
h
.
toggleClass
(
"
sortable
"
,
i
.
sortable
);
var
p
,
q
,
r
,
s
=
a
(
'
<div class="datatable-head"/>
'
);
for
(
c
=
a
(
"
<tr/>
"
),
e
=
a
(
"
<tr/>
"
),
f
=
a
(
"
<tr/>
"
),
d
=
0
;
d
<
k
.
length
;
d
++
)
r
=
k
[
d
],
p
=
d
<
j
.
flexStart
?
c
:
d
>=
j
.
flexStart
&&
d
<=
j
.
flexEnd
?
f
:
e
,
0
===
d
&&
m
&&
p
.
append
(
'
<th data-index="check" class="check-all check-btn"><i class="icon-check-empty"></i></th>
'
),
r
.
ignore
||
(
q
=
a
(
"
<th/>
"
),
q
.
toggleClass
(
"
sort-down
"
,
"
down
"
===
r
.
sort
).
toggleClass
(
"
sort-up
"
,
"
up
"
===
r
.
sort
).
toggleClass
(
"
sort-disabled
"
,
r
.
sort
===!
1
),
q
.
addClass
(
r
.
cssClass
).
addClass
(
r
.
colClass
).
html
(
r
.
text
).
attr
({
"
data-index
"
:
d
,
"
data-type
"
:
r
.
type
,
style
:
r
.
css
}),
p
.
append
(
q
));
var
t
;
j
.
fixedLeft
&&
(
t
=
a
(
o
),
t
.
addClass
(
"
fixed-left
"
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
find
(
"
thead
"
).
append
(
c
),
s
.
append
(
t
)),
j
.
flexArea
&&
(
t
=
a
(
o
),
t
.
addClass
(
"
flexarea
"
).
find
(
"
.datatable-wrapper
"
).
append
(
'
<div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div>
'
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
find
(
"
thead
"
).
append
(
f
),
s
.
append
(
t
)),
j
.
fixedRight
&&
(
t
=
a
(
o
),
t
.
addClass
(
"
fixed-right
"
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
find
(
"
thead
"
).
append
(
e
),
s
.
append
(
t
)),
h
.
append
(
s
);
var
u
,
v
,
w
,
x
,
y
,
z
,
A
,
B
,
C
=
a
(
'
<div class="datatable-rows">
'
),
D
=
l
.
length
;
c
=
a
(
"
<tbody/>
"
),
e
=
a
(
"
<tbody/>
"
),
f
=
a
(
"
<tbody/>
"
);
for
(
var
E
=
0
;
D
>
E
;
++
E
){
for
(
z
=
l
[
E
],
"
undefined
"
==
typeof
z
.
id
&&
(
z
.
id
=
E
),
z
.
index
=
E
,
u
=
a
(
"
<tr/>
"
),
u
.
addClass
(
z
.
cssClass
).
toggleClass
(
i
.
checkedClass
,
z
.
checked
).
attr
({
"
data-index
"
:
E
,
"
data-id
"
:
z
.
id
}),
v
=
u
.
clone
(),
w
=
u
.
clone
(),
B
=
z
.
data
.
length
,
d
=
0
;
B
>
d
;
++
d
)
A
=
z
.
data
[
d
],
p
=
d
<
j
.
flexStart
?
u
:
d
>=
j
.
flexStart
&&
d
<=
j
.
flexEnd
?
v
:
w
,
0
===
d
&&
m
&&
(
y
=
a
(
'
<td data-index="check" class="check-row check-btn"><i class="icon-check-empty"></i></td>
'
),
i
.
checkboxName
&&
y
.
append
(
'
<input class="hide" type="checkbox" name="
'
+
i
.
checkboxName
+
'
" value="
'
+
z
.
id
+
'
">
'
),
p
.
append
(
y
)),
k
[
d
].
ignore
||
(
a
.
isPlainObject
(
A
)
||
(
A
=
{
text
:
A
,
row
:
E
,
index
:
d
},
z
.
data
[
d
]
=
A
),
x
=
a
(
"
<td/>
"
),
x
.
html
(
A
.
text
).
addClass
(
A
.
cssClass
).
addClass
(
k
[
d
].
colClass
).
attr
({
"
data-row
"
:
E
,
"
data-index
"
:
d
,
"
data-flex
"
:
!
1
,
"
data-type
"
:
k
[
d
].
type
,
style
:
A
.
css
}),
p
.
append
(
x
));
c
.
append
(
u
),
f
.
append
(
v
),
e
.
append
(
w
)}
var
F
;
j
.
fixedLeft
&&
(
F
=
a
(
n
),
F
.
addClass
(
"
fixed-left
"
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
append
(
c
),
C
.
append
(
F
)),
j
.
flexArea
&&
(
F
=
a
(
n
),
F
.
addClass
(
"
flexarea
"
).
find
(
"
.datatable-wrapper
"
).
append
(
'
<div class="scrolled-shadow scrolled-in-shadow"></div><div class="scrolled-shadow scrolled-out-shadow"></div>
'
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
append
(
f
),
C
.
append
(
F
)),
j
.
fixedRight
&&
(
F
=
a
(
n
),
F
.
addClass
(
"
fixed-right
"
).
find
(
"
table
"
).
addClass
(
i
.
tableClass
).
append
(
e
),
C
.
append
(
F
)),
h
.
append
(
C
),
j
.
flexArea
&&
h
.
append
(
'
<div class="scroll-wrapper"><div class="scroll-slide scroll-pos-
'
+
i
.
scrollPos
+
'
"><div class="bar"></div></div></div>
'
);
var
G
=
h
.
children
(
"
.datatable-footer
"
).
detach
();
j
.
footer
?(
h
.
append
(
a
(
'
<div class="datatable-footer"/>
'
).
append
(
j
.
footer
)),
j
.
footer
=
null
):
G
.
length
&&
h
.
append
(
G
),
g
.
$datatable
=
h
.
data
(
b
,
g
),
g
.
isTable
&&
g
.
firstShow
&&
(
g
.
$table
.
attr
(
"
data-datatable-id
"
,
this
.
id
).
hide
().
after
(
h
),
g
.
firstShow
=!
1
),
g
.
bindEvents
(),
g
.
refreshSize
(),
g
.
callEvent
(
"
render
"
)},
c
.
prototype
.
bindEvents
=
function
(){
var
b
=
this
,
c
=
this
.
data
,
d
=
this
.
options
,
e
=
window
.
store
,
f
=
this
.
$datatable
,
g
=
b
.
$dataSpans
=
f
.
children
(
"
.datatable-head, .datatable-rows
"
).
find
(
"
.datatable-span
"
),
h
=
b
.
$rowsSpans
=
f
.
children
(
"
.datatable-rows
"
).
children
(
"
.datatable-rows-span
"
),
i
=
b
.
$headSpans
=
f
.
children
(
"
.datatable-head
"
).
children
(
"
.datatable-head-span
"
),
j
=
b
.
$cells
=
g
.
find
(
"
td, th
"
),
k
=
b
.
$dataCells
=
j
.
filter
(
"
td
"
);
b
.
$headCells
=
j
.
filter
(
"
th
"
);
var
l
=
b
.
$rows
=
b
.
$rowsSpans
.
find
(
"
.table > tbody > tr
"
);
if
(
d
.
rowHover
){
var
m
=
d
.
hoverClass
;
h
.
on
(
"
mouseenter
"
,
"
td
"
,
function
(){
k
.
filter
(
"
.
"
+
m
).
removeClass
(
m
),
l
.
filter
(
"
.
"
+
m
).
removeClass
(
m
),
l
.
filter
(
'
[data-index="
'
+
a
(
this
).
addClass
(
m
).
closest
(
"
tr
"
).
data
(
"
index
"
)
+
'
"]
'
).
addClass
(
m
)}).
on
(
"
mouseleave
"
,
"
td
"
,
function
(){
k
.
filter
(
"
.
"
+
m
).
removeClass
(
m
),
l
.
filter
(
"
.
"
+
m
).
removeClass
(
m
)})}
if
(
d
.
colHover
){
var
n
=
d
.
colHoverClass
;
i
.
on
(
"
mouseenter
"
,
"
th
"
,
function
(){
j
.
filter
(
"
.
"
+
n
).
removeClass
(
n
),
j
.
filter
(
'
[data-index="
'
+
a
(
this
).
data
(
"
index
"
)
+
'
"]
'
).
addClass
(
n
)}).
on
(
"
mouseleave
"
,
"
th
"
,
function
(){
j
.
filter
(
"
.
"
+
n
).
removeClass
(
n
)})}
if
(
c
.
flexArea
){
var
o
,
p
,
q
,
r
,
s
,
t
,
u
,
v
=
f
.
find
(
"
.scroll-slide
"
),
w
=
f
.
find
(
"
.datatable-span.flexarea
"
),
x
=
f
.
find
(
"
.datatable-span.fixed-left
"
),
y
=
f
.
find
(
"
.datatable-span.flexarea .table
"
),
z
=
v
.
children
(
"
.bar
"
),
A
=
b
.
id
+
"
_scrollOffset
"
;
b
.
width
=
f
.
width
(),
f
.
resize
(
function
(){
b
.
width
=
f
.
width
()});
var
B
=
function
(
a
,
b
){
s
=
Math
.
max
(
0
,
Math
.
min
(
o
-
p
,
a
)),
b
||
f
.
addClass
(
"
scrolling
"
),
z
.
css
(
"
left
"
,
s
),
u
=
0
-
Math
.
floor
((
q
-
o
)
*
s
/
(
o
-
p
)),
y
.
css
(
"
left
"
,
u
),
r
=
s
,
f
.
toggleClass
(
"
scrolled-in
"
,
s
>
2
).
toggleClass
(
"
scrolled-out
"
,
o
-
p
-
2
>
s
),
d
.
storage
&&
e
.
pageSet
(
A
,
s
)},
C
=
function
(){
o
=
w
.
width
(),
v
.
width
(
o
).
css
(
"
left
"
,
x
.
width
()),
q
=
y
.
width
(),
p
=
Math
.
floor
(
o
*
o
/
q
),
z
.
css
(
"
width
"
,
p
),
y
.
css
(
"
min-width
"
,
o
),
f
.
toggleClass
(
"
show-scroll-slide
"
,
q
>
o
),
t
||
o
===
p
||
(
t
=!
0
,
B
(
e
.
pageGet
(
A
,
0
),
!
0
)),
f
.
hasClass
(
"
size-changing
"
)
&&
B
(
s
,
!
0
)};
w
.
resize
(
C
),
d
.
storage
&&
C
();
var
D
=
{
move
:
!
1
,
stopPropagation
:
!
0
,
drag
:
function
(
a
){
B
(
z
.
position
().
left
+
a
.
smallOffset
.
x
*
(
a
.
element
.
hasClass
(
"
bar
"
)?
1
:
-
1
))},
finish
:
function
(){
f
.
removeClass
(
"
scrolling
"
)}};
z
.
draggable
(
D
),
d
.
flexHeadDrag
&&
f
.
find
(
"
.datatable-head-span.flexarea
"
).
draggable
(
D
),
v
.
mousedown
(
function
(
a
){
var
b
=
a
.
pageX
-
v
.
offset
().
left
;
B
(
b
-
p
/
2
)})}
if
(
d
.
checkable
){
var
E
,
F
=
b
.
id
+
"
_checkedStatus
"
,
G
=
d
.
checkedClass
,
H
=
function
(){
var
f
=
h
.
first
().
find
(
"
.table > tbody > tr
"
),
g
=
f
.
filter
(
"
.
"
+
G
);
f
.
find
(
"
.check-row input:checkbox
"
).
prop
(
"
checked
"
,
!
1
);
var
j
=
{
checkedAll
:
f
.
length
===
g
.
length
&&
g
.
length
>
0
,
checks
:
g
.
map
(
function
(){
return
E
=
a
(
this
).
data
(
"
id
"
),
d
.
checkboxName
&&
a
(
this
).
find
(
"
.check-row input:checkbox
"
).
prop
(
"
checked
"
,
!
0
),
E
}).
toArray
()};
a
.
each
(
c
.
rows
,
function
(
b
,
c
){
c
.
checked
=
a
.
inArray
(
c
.
id
,
j
.
checks
)
>-
1
}),
i
.
find
(
"
.check-all
"
).
toggleClass
(
"
checked
"
,
j
.
checkedAll
),
d
.
storage
&&
e
.
pageSet
(
F
,
j
),
b
.
callEvent
(
"
checksChanged
"
,{
checks
:
j
})};
this
.
$rowsSpans
.
on
(
"
click
"
,
d
.
checkByClickRow
?
"
tr
"
:
"
.check-row
"
,
function
(){
l
.
filter
(
'
[data-index="
'
+
a
(
this
).
closest
(
"
tr
"
).
data
(
"
index
"
)
+
'
"]
'
).
toggleClass
(
G
),
H
()});
var
I
=
"
click.zui.datatable.check-all
"
;
if
(
this
.
$datatable
.
off
(
I
).
on
(
I
,
"
.check-all
"
,
function
(){
l
.
toggleClass
(
G
,
a
(
this
).
toggleClass
(
"
checked
"
).
hasClass
(
"
checked
"
)),
H
()}).
on
(
"
click
"
,
"
.check-none
"
,
function
(){
l
.
toggleClass
(
G
,
!
1
),
H
()}).
on
(
"
click
"
,
"
.check-inverse
"
,
function
(){
l
.
toggleClass
(
G
),
H
()}),
d
.
storage
){
var
J
=
e
.
pageGet
(
F
);
J
&&
(
i
.
find
(
"
.check-all
"
).
toggleClass
(
"
checked
"
,
J
.
checkedAll
),
J
.
checkedAll
?
l
.
addClass
(
G
):(
l
.
removeClass
(
G
),
a
.
each
(
J
.
checks
,
function
(
a
,
b
){
l
.
filter
(
'
[data-id="
'
+
b
+
'
"]
'
).
addClass
(
G
)})),
J
.
checks
.
length
&&
H
())}}
if
(
d
.
fixedHeader
){
var
K
,
L
,
M
,
N
=
f
.
children
(
"
.datatable-head
"
),
O
=
d
.
fixedHeaderOffset
||
a
(
"
.navbar.navbar-fixed-top
"
).
height
()
||
0
,
P
=
function
(){
K
=
f
.
offset
().
top
,
M
=
a
(
window
).
scrollTop
(),
L
=
f
.
height
(),
f
.
toggleClass
(
"
head-fixed
"
,
M
+
O
>
K
&&
K
+
L
>
M
+
O
),
f
.
hasClass
(
"
head-fixed
"
)?
N
.
css
({
width
:
f
.
width
(),
top
:
O
}):
N
.
attr
(
"
style
"
,
""
)};
a
(
window
).
scroll
(
P
),
P
()}
d
.
sortable
?(
i
.
on
(
"
click
"
,
"
th:not(.sort-disabled, .check-btn)
"
,
function
(){
f
.
hasClass
(
"
size-changing
"
)
||
b
.
sortTable
(
a
(
this
))}),
d
.
storage
&&
b
.
sortTable
()):
d
.
mergeRows
&&
this
.
mergeRows
()},
c
.
prototype
.
mergeRows
=
function
(){
for
(
var
b
=
this
.
$rowsSpans
.
find
(
"
.table > tbody > tr > td
"
),
c
=
this
.
data
.
cols
,
d
=
0
;
d
<
c
.
length
;
d
++
){
var
e
=
c
[
d
];
if
(
e
.
mergeRows
){
var
f
=
b
.
filter
(
'
[data-index="
'
+
d
+
'
"]
'
);
if
(
f
.
length
>
1
){
var
g
;
f
.
each
(
function
(){
var
b
=
a
(
this
);
g
&&
b
.
html
()
===
g
.
html
()?(
g
.
attr
(
"
rowspan
"
,(
g
.
attr
(
"
rowspan
"
)
||
1
)
+
1
).
css
(
"
vertical-align
"
,
"
middle
"
),
b
.
remove
()):
g
=
b
})}}}},
c
.
prototype
.
sortTable
=
function
(
b
){
var
c
=
window
.
store
,
d
=
this
.
options
,
e
=
this
.
id
+
"
_datatableSorter
"
,
f
=
d
.
storage
?
c
.
pageGet
(
e
):
null
;
if
(
b
||
(
b
=
f
?
this
.
$headCells
.
filter
(
'
[data-index="
'
+
f
.
index
+
'
"]
'
).
addClass
(
"
sort-
"
+
f
.
type
):
this
.
$headCells
.
filter
(
"
.sort-up, .sort-down
"
).
first
()),
b
.
length
){
var
g
,
h
,
i
,
j
=
this
.
data
,
k
=
j
.
cols
,
l
=
j
.
rows
,
m
=
this
.
$headCells
;
g
=!
b
.
hasClass
(
"
sort-up
"
),
m
.
removeClass
(
"
sort-up sort-down
"
),
b
.
addClass
(
g
?
"
sort-up
"
:
"
sort-down
"
),
i
=
b
.
data
(
"
index
"
),
g
=
b
.
hasClass
(
"
sort-up
"
),
a
.
each
(
k
,
function
(
a
,
b
){
a
==
i
||
"
up
"
!==
b
.
sort
&&
"
down
"
!==
b
.
sort
?
a
==
i
&&
(
b
.
sort
=
g
?
"
up
"
:
"
down
"
,
h
=
b
.
type
):
b
.
sort
=!
0
});
var
n
,
o
,
p
,
q
=
this
.
$dataCells
.
filter
(
'
[data-index="
'
+
i
+
'
"]
'
);
l
.
sort
(
function
(
a
,
b
){
return
a
=
a
.
data
[
i
],
b
=
b
.
data
[
i
],
n
=
q
.
filter
(
'
[data-row="
'
+
a
.
row
+
'
"]
'
).
text
(),
o
=
q
.
filter
(
'
[data-row="
'
+
b
.
row
+
'
"]
'
).
text
(),
"
number
"
===
h
?(
n
=
parseFloat
(
n
),
o
=
parseFloat
(
o
)):
"
date
"
===
h
?(
n
=
Date
.
parse
(
n
),
o
=
Date
.
parse
(
o
)):(
n
=
n
.
toLowerCase
(),
o
=
o
.
toLowerCase
()),
p
=
n
>
o
?
1
:
o
>
n
?
-
1
:
0
,
g
&&
(
p
=-
1
*
p
),
p
});
var
r
,
s
,
t
,
u
=
this
.
$rows
,
v
=
[];
a
.
each
(
l
,
function
(
b
,
c
){
r
=
u
.
filter
(
'
[data-index="
'
+
c
.
index
+
'
"]
'
),
r
.
each
(
function
(
b
){
t
=
a
(
this
),
s
=
v
[
b
],
s
?
s
.
after
(
t
):
t
.
parent
().
prepend
(
t
),
v
[
b
]
=
t
})}),
f
=
{
index
:
i
,
type
:
g
?
"
up
"
:
"
down
"
},
d
.
storage
&&
c
.
pageSet
(
e
,
f
),
this
.
callEvent
(
"
sort
"
,{
sorter
:
f
})}},
c
.
prototype
.
refreshSize
=
function
(){
var
b
,
c
=
this
.
$datatable
,
d
=
this
.
options
,
e
=
this
.
data
.
rows
,
f
=
this
.
data
.
cols
;
c
.
find
(
"
.datatable-span.fixed-left
"
).
css
(
"
width
"
,
d
.
fixedLeftWidth
),
c
.
find
(
"
.datatable-span.fixed-right
"
).
css
(
"
width
"
,
d
.
fixedRightWidth
);
var
g
=
function
(
b
){
var
c
,
d
=
0
;
return
b
.
css
(
"
height
"
,
"
auto
"
),
b
.
each
(
function
(){
c
=
a
(
this
),
c
.
attr
(
"
rowspan
"
)
||
(
d
=
Math
.
max
(
d
,
c
.
height
()))}),
d
},
h
=
this
.
$dataCells
,
i
=
this
.
$cells
,
j
=
this
.
$headCells
;
for
(
b
=
0
;
b
<
f
.
length
;
++
b
)
i
.
filter
(
'
[data-index="
'
+
b
+
'
"]
'
).
css
(
"
width
"
,
f
[
b
].
width
);
j
.
height
(
g
(
j
));
var
k
;
for
(
b
=
0
;
b
<
e
.
length
;
++
b
)
k
=
h
.
filter
(
'
[data-row="
'
+
b
+
'
"]
'
),
k
.
height
(
g
(
k
))},
c
.
prototype
.
callEvent
=
function
(
a
,
b
){
var
c
=
this
.
$
.
callEvent
(
a
+
"
.
"
+
this
.
name
,
b
,
this
).
result
;
return
!
(
void
0
!==
c
&&!
c
)},
a
.
fn
.
datatable
=
function
(
d
){
return
this
.
each
(
function
(){
var
e
=
a
(
this
),
f
=
e
.
data
(
b
),
g
=
"
object
"
==
typeof
d
&&
d
;
f
||
e
.
data
(
b
,
f
=
new
c
(
this
,
g
)),
"
string
"
==
typeof
d
&&
f
[
d
]()})},
a
.
fn
.
datatable
.
Constructor
=
c
}(
jQuery
);
\ No newline at end of file
src/js/datatable.js
浏览文件 @
787b6a6e
...
...
@@ -938,11 +938,12 @@
var
findMaxHeight
=
function
(
$cells
)
{
var
mx
=
0
;
var
mx
=
0
,
$cell
;
$cells
.
css
(
'
height
'
,
'
auto
'
);
$cells
.
each
(
function
()
{
mx
=
Math
.
max
(
mx
,
$
(
this
).
height
());
$cell
=
$
(
this
);
if
(
!
$cell
.
attr
(
'
rowspan
'
))
mx
=
Math
.
max
(
mx
,
$cell
.
height
());
});
return
mx
;
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录