Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zui
提交
c3e47472
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,发现更多精彩内容 >>
提交
c3e47472
编写于
8月 11, 2014
作者:
C
Catouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* save sorter config with local storage.
上级
40ead4b9
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
66 addition
and
20 deletion
+66
-20
dist/js/zui.js
dist/js/zui.js
+32
-9
dist/js/zui.min.js
dist/js/zui.min.js
+2
-2
src/js/datatable.js
src/js/datatable.js
+32
-9
未找到文件。
dist/js/zui.js
浏览文件 @
c3e47472
...
...
@@ -4874,11 +4874,7 @@ var imgReady = (function () {
var
$th
,
sortdown
;
this
.
$headSpans
.
on
(
'
click
'
,
'
th:not(.sort-disabled, .check-btn)
'
,
function
()
{
$th
=
$
(
this
);
sortdown
=
$th
.
hasClass
(
'
sort-down
'
);
$headCells
.
removeClass
(
'
sort-up sort-down
'
);
$th
.
addClass
(
sortdown
?
'
sort-up
'
:
'
sort-down
'
);
self
.
sortTable
(
$th
);
self
.
sortTable
(
$
(
this
));
});
}
...
...
@@ -4887,17 +4883,39 @@ var imgReady = (function () {
DataTable
.
prototype
.
sortTable
=
function
(
$th
)
{
var
sorterStoreName
=
self
.
id
+
'
_
'
+
'
datatableSorter
'
;
var
sorter
=
store
.
pageGet
(
sorterStoreName
);
if
(
!
$th
)
{
if
(
sorter
)
{
$th
=
this
.
$headCells
.
filter
(
'
[data-index="
'
+
sorter
.
index
+
'
"]
'
).
addClass
(
'
sort-
'
+
sorter
.
type
);
}
else
{
$th
=
this
.
$headCells
.
filter
(
'
.sort-up, .sort-down
'
).
first
();
}
}
if
(
!
$th
.
length
)
{
return
;
}
var
data
=
this
.
data
;
var
cols
=
data
.
cols
,
rows
=
data
.
rows
,
$headCells
=
this
.
$headCells
,
sortUp
,
type
,
sortCol
,
index
;
if
(
!
$th
)
{
$th
=
this
.
$headCells
.
find
(
'
.sort-up, .sort-down
'
).
first
(
);
}
sortUp
=
!
$th
.
hasClass
(
'
sort-up
'
);
$headCells
.
removeClass
(
'
sort-up sort-down
'
);
$th
.
addClass
(
sortUp
?
'
sort-up
'
:
'
sort-down
'
);
index
=
$th
.
data
(
'
index
'
);
sortUp
=
$th
.
hasClass
(
'
sort-up
'
);
...
...
@@ -4958,6 +4976,9 @@ var imgReady = (function () {
lastRows
[
rIdx
]
=
$r
;
});
});
// save sort with local storage
store
.
pageSet
(
sorterStoreName
,
{
index
:
index
,
type
:
sortUp
?
'
up
'
:
'
down
'
});
}
DataTable
.
prototype
.
refresh
=
function
()
...
...
@@ -4974,6 +4995,8 @@ var imgReady = (function () {
{
$cells
.
filter
(
'
[data-index="
'
+
i
+
'
"]
'
).
css
(
'
width
'
,
cols
[
i
].
width
);
}
this
.
sortTable
();
}
$
.
fn
.
datatable
=
function
(
option
)
...
...
dist/js/zui.min.js
浏览文件 @
c3e47472
此差异已折叠。
点击以展开。
src/js/datatable.js
浏览文件 @
c3e47472
...
...
@@ -560,11 +560,7 @@
var
$th
,
sortdown
;
this
.
$headSpans
.
on
(
'
click
'
,
'
th:not(.sort-disabled, .check-btn)
'
,
function
()
{
$th
=
$
(
this
);
sortdown
=
$th
.
hasClass
(
'
sort-down
'
);
$headCells
.
removeClass
(
'
sort-up sort-down
'
);
$th
.
addClass
(
sortdown
?
'
sort-up
'
:
'
sort-down
'
);
self
.
sortTable
(
$th
);
self
.
sortTable
(
$
(
this
));
});
}
...
...
@@ -573,17 +569,39 @@
DataTable
.
prototype
.
sortTable
=
function
(
$th
)
{
var
sorterStoreName
=
self
.
id
+
'
_
'
+
'
datatableSorter
'
;
var
sorter
=
store
.
pageGet
(
sorterStoreName
);
if
(
!
$th
)
{
if
(
sorter
)
{
$th
=
this
.
$headCells
.
filter
(
'
[data-index="
'
+
sorter
.
index
+
'
"]
'
).
addClass
(
'
sort-
'
+
sorter
.
type
);
}
else
{
$th
=
this
.
$headCells
.
filter
(
'
.sort-up, .sort-down
'
).
first
();
}
}
if
(
!
$th
.
length
)
{
return
;
}
var
data
=
this
.
data
;
var
cols
=
data
.
cols
,
rows
=
data
.
rows
,
$headCells
=
this
.
$headCells
,
sortUp
,
type
,
sortCol
,
index
;
if
(
!
$th
)
{
$th
=
this
.
$headCells
.
find
(
'
.sort-up, .sort-down
'
).
first
(
);
}
sortUp
=
!
$th
.
hasClass
(
'
sort-up
'
);
$headCells
.
removeClass
(
'
sort-up sort-down
'
);
$th
.
addClass
(
sortUp
?
'
sort-up
'
:
'
sort-down
'
);
index
=
$th
.
data
(
'
index
'
);
sortUp
=
$th
.
hasClass
(
'
sort-up
'
);
...
...
@@ -644,6 +662,9 @@
lastRows
[
rIdx
]
=
$r
;
});
});
// save sort with local storage
store
.
pageSet
(
sorterStoreName
,
{
index
:
index
,
type
:
sortUp
?
'
up
'
:
'
down
'
});
}
DataTable
.
prototype
.
refresh
=
function
()
...
...
@@ -660,6 +681,8 @@
{
$cells
.
filter
(
'
[data-index="
'
+
i
+
'
"]
'
).
css
(
'
width
'
,
cols
[
i
].
width
);
}
this
.
sortTable
();
}
$
.
fn
.
datatable
=
function
(
option
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录