Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
018cb79a
Commit
018cb79a
authored
Jun 04, 2017
by
Swifly
Committed by
stylefeng
Jun 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request !5 from Swifly/master
parents
1c66f199
43936a15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
22 deletions
+29
-22
src/main/webapp/static/js/plugins/jquery-treegrid/extension/jquery.treegrid.extension.js
+29
-22
No files found.
src/main/webapp/static/js/plugins/jquery-treegrid/extension/jquery.treegrid.extension.js
View file @
018cb79a
...
@@ -90,15 +90,24 @@
...
@@ -90,15 +90,24 @@
}
}
// 加载数据
// 加载数据
target
.
load
=
function
(
parms
){
target
.
load
=
function
(
parms
){
var
_tbody
=
target
.
find
(
"tbody"
);
// 加载数据前先清空
target
.
html
(
""
);
// 构造表头
var
thr
=
$
(
'<tr></tr>'
);
$
.
each
(
options
.
columns
,
function
(
i
,
item
)
{
var
th
=
$
(
'<th style="padding:10px;"></th>'
);
th
.
text
(
item
.
title
);
thr
.
append
(
th
);
});
var
thead
=
$
(
'<thead class="treegrid-thead"></thead>'
);
thead
.
append
(
thr
);
target
.
append
(
thead
);
// 构造表体
var
tbody
=
$
(
'<tbody class="treegrid-tbody"></tbody>'
);
target
.
append
(
tbody
);
// 添加加载loading
// 添加加载loading
var
_loading
=
'<tr><td colspan="'
+
options
.
columns
.
length
+
'" style="height:50px"><div style="display: block;line-height:50px;text-align: center;">正在努力地加载数据中,请稍候……</div></td></tr>'
var
_loading
=
'<tr><td colspan="'
+
options
.
columns
.
length
+
'"><div style="display: block;text-align: center;">正在努力地加载数据中,请稍候……</div></td></tr>'
if
(
_tbody
[
0
]){
tbody
.
html
(
_loading
);
_tbody
.
html
(
_loading
);
}
else
{
target
.
html
(
_loading
);
}
debugger
;
$
.
ajax
({
$
.
ajax
({
type
:
options
.
type
,
type
:
options
.
type
,
url
:
options
.
url
,
url
:
options
.
url
,
...
@@ -106,19 +115,12 @@
...
@@ -106,19 +115,12 @@
dataType
:
"JSON"
,
dataType
:
"JSON"
,
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
// 加载完数据先清空
// 加载完数据先清空
target
.
html
(
""
);
tbody
.
html
(
""
);
// 构造表头
if
(
!
data
||
data
.
length
<=
0
){
var
thr
=
$
(
'<tr></tr>'
);
var
_empty
=
'<tr><td colspan="'
+
options
.
columns
.
length
+
'"><div style="display: block;text-align: center;">没有找到匹配的记录</div></td></tr>'
$
.
each
(
options
.
columns
,
function
(
i
,
item
)
{
tbody
.
html
(
_empty
);
var
th
=
$
(
'<th style="padding:10px;"></th>'
);
return
;
th
.
text
(
item
.
title
);
}
thr
.
append
(
th
);
});
var
thead
=
$
(
'<thead class="treegrid-thead"></thead>'
);
thead
.
append
(
thr
);
target
.
append
(
thead
);
// 构造表体
var
tbody
=
$
(
'<tbody class="treegrid-tbody"></tbody>'
);
var
rootNode
=
target
.
getRootNodes
(
data
);
var
rootNode
=
target
.
getRootNodes
(
data
);
$
.
each
(
rootNode
,
function
(
i
,
item
)
{
$
.
each
(
rootNode
,
function
(
i
,
item
)
{
var
tr
=
$
(
'<tr></tr>'
);
var
tr
=
$
(
'<tr></tr>'
);
...
@@ -166,7 +168,12 @@
...
@@ -166,7 +168,12 @@
}
}
}
}
});
});
}
},
error
:
function
(
xhr
,
textStatus
){
var
_errorMsg
=
'<tr><td colspan="'
+
options
.
columns
.
length
+
'"><div style="display: block;text-align: center;">'
+
xhr
.
responseText
+
'</div></td></tr>'
tbody
.
html
(
_errorMsg
);
debugger
;
},
});
});
}
}
if
(
options
.
url
)
{
if
(
options
.
url
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment