Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yaru
fgqyxxlr
Commits
c2e425aa
Commit
c2e425aa
authored
Sep 24, 2019
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加表格行内编辑示例
parent
538e7dcc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
132 additions
and
8 deletions
+132
-8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java
+9
-0
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.css
+0
-0
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js
+0
-0
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-table-editable.min.js
+0
-8
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/clear.png
+0
-0
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/loading.gif
+0
-0
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
+1
-0
ruoyi-admin/src/main/resources/templates/demo/table/editable.html
+111
-0
ruoyi-admin/src/main/resources/templates/include.html
+10
-0
ruoyi-admin/src/main/resources/templates/index.html
+1
-0
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java
View file @
c2e425aa
...
...
@@ -195,6 +195,15 @@ public class DemoTableController extends BaseController
}
/**
* 表格行内编辑操作
*/
@GetMapping
(
"/editable"
)
public
String
editable
()
{
return
prefix
+
"/editable"
;
}
/**
* 表格其他操作
*/
@GetMapping
(
"/other"
)
...
...
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.css
0 → 100644
View file @
c2e425aa
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js
0 → 100644
View file @
c2e425aa
This diff is collapsed.
Click to expand it.
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/bootstrap-table-editable.min.js
deleted
100644 → 0
View file @
538e7dcc
/*
* bootstrap-table - v1.11.0 - 2016-07-02
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2016 zhixin wen
* Licensed MIT License
*/
!
function
(
a
){
"use strict"
;
a
.
extend
(
a
.
fn
.
bootstrapTable
.
defaults
,{
editable
:
!
0
,
onEditableInit
:
function
(){
return
!
1
},
onEditableSave
:
function
(){
return
!
1
},
onEditableShown
:
function
(){
return
!
1
},
onEditableHidden
:
function
(){
return
!
1
}}),
a
.
extend
(
a
.
fn
.
bootstrapTable
.
Constructor
.
EVENTS
,{
"editable-init.bs.table"
:
"onEditableInit"
,
"editable-save.bs.table"
:
"onEditableSave"
,
"editable-shown.bs.table"
:
"onEditableShown"
,
"editable-hidden.bs.table"
:
"onEditableHidden"
});
var
b
=
a
.
fn
.
bootstrapTable
.
Constructor
,
c
=
b
.
prototype
.
initTable
,
d
=
b
.
prototype
.
initBody
;
b
.
prototype
.
initTable
=
function
(){
var
b
=
this
;
c
.
apply
(
this
,
Array
.
prototype
.
slice
.
apply
(
arguments
)),
this
.
options
.
editable
&&
a
.
each
(
this
.
columns
,
function
(
c
,
d
){
if
(
d
.
editable
){
var
e
=
{},
f
=
[],
g
=
"editable-"
,
h
=
function
(
a
,
b
){
var
c
=
a
.
replace
(
/
([
A-Z
])
/g
,
function
(
a
){
return
"-"
+
a
.
toLowerCase
()});
if
(
c
.
slice
(
0
,
g
.
length
)
==
g
){
var
d
=
c
.
replace
(
g
,
"data-"
);
e
[
d
]
=
b
}};
a
.
each
(
b
.
options
,
h
),
d
.
formatter
=
d
.
formatter
||
function
(
a
){
return
a
},
d
.
_formatter
=
d
.
_formatter
?
d
.
_formatter
:
d
.
formatter
,
d
.
formatter
=
function
(
c
,
g
,
i
){
var
j
=
d
.
_formatter
?
d
.
_formatter
(
c
,
g
,
i
):
c
;
a
.
each
(
d
,
h
),
a
.
each
(
e
,
function
(
a
,
b
){
f
.
push
(
" "
+
a
+
'="'
+
b
+
'"'
)});
var
k
=!
1
;
return
d
.
editable
.
hasOwnProperty
(
"noeditFormatter"
)
&&
(
k
=
d
.
editable
.
noeditFormatter
(
c
,
g
,
i
)),
k
===!
1
?[
'<a href="javascript:void(0)"'
,
' data-name="'
+
d
.
field
+
'"'
,
' data-pk="'
+
g
[
b
.
options
.
idField
]
+
'"'
,
' data-value="'
+
j
+
'"'
,
f
.
join
(
""
),
"></a>"
].
join
(
""
):
k
}}})},
b
.
prototype
.
initBody
=
function
(){
var
b
=
this
;
d
.
apply
(
this
,
Array
.
prototype
.
slice
.
apply
(
arguments
)),
this
.
options
.
editable
&&
(
a
.
each
(
this
.
columns
,
function
(
c
,
d
){
d
.
editable
&&
(
b
.
$body
.
find
(
'a[data-name="'
+
d
.
field
+
'"]'
).
editable
(
d
.
editable
).
off
(
"save"
).
on
(
"save"
,
function
(
c
,
e
){
var
f
=
b
.
getData
(),
g
=
a
(
this
).
parents
(
"tr[data-index]"
).
data
(
"index"
),
h
=
f
[
g
],
i
=
h
[
d
.
field
];
a
(
this
).
data
(
"value"
,
e
.
submitValue
),
h
[
d
.
field
]
=
e
.
submitValue
,
b
.
trigger
(
"editable-save"
,
d
.
field
,
h
,
i
,
a
(
this
)),
b
.
resetFooter
()}),
b
.
$body
.
find
(
'a[data-name="'
+
d
.
field
+
'"]'
).
editable
(
d
.
editable
).
off
(
"shown"
).
on
(
"shown"
,
function
(
c
,
e
){
var
f
=
b
.
getData
(),
g
=
a
(
this
).
parents
(
"tr[data-index]"
).
data
(
"index"
),
h
=
f
[
g
];
b
.
trigger
(
"editable-shown"
,
d
.
field
,
h
,
a
(
this
),
e
)}),
b
.
$body
.
find
(
'a[data-name="'
+
d
.
field
+
'"]'
).
editable
(
d
.
editable
).
off
(
"hidden"
).
on
(
"hidden"
,
function
(
c
,
e
){
var
f
=
b
.
getData
(),
g
=
a
(
this
).
parents
(
"tr[data-index]"
).
data
(
"index"
),
h
=
f
[
g
];
b
.
trigger
(
"editable-hidden"
,
d
.
field
,
h
,
a
(
this
),
e
)}))}),
this
.
trigger
(
"editable-init"
))}}(
jQuery
);
\ No newline at end of file
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/clear.png
0 → 100644
View file @
c2e425aa
244 Bytes
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/editable/loading.gif
0 → 100644
View file @
c2e425aa
1.81 KB
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
View file @
c2e425aa
...
...
@@ -83,6 +83,7 @@
onDblClickRow
:
options
.
onDblClickRow
,
// 双击某行触发的事件
onClickCell
:
options
.
onClickCell
,
// 单击某格触发的事件
onDblClickCell
:
options
.
onDblClickCell
,
// 双击某格触发的事件
onEditableSave
:
options
.
onEditableSave
,
// 行内编辑保存的事件
rememberSelected
:
options
.
rememberSelected
,
// 启用翻页记住前面的选择
fixedColumns
:
options
.
fixedColumns
,
// 是否启用冻结列(左侧)
fixedNumber
:
options
.
fixedNumber
,
// 列冻结的个数(左侧)
...
...
ruoyi-admin/src/main/resources/templates/demo/table/editable.html
0 → 100644
View file @
c2e425aa
<!DOCTYPE html>
<html
lang=
"zh"
xmlns:th=
"http://www.thymeleaf.org"
xmlns:shiro=
"http://www.pollix.at/thymeleaf/shiro"
>
<head>
<th:block
th:include=
"include :: header('表格行内编辑')"
/>
<th:block
th:include=
"include :: bootstrap-editable-css"
/>
</head>
<body
class=
"gray-bg"
>
<div
class=
"container-div"
>
<div
class=
"btn-group-sm"
id=
"toolbar"
role=
"group"
>
<a
class=
"btn btn-info"
onclick=
"getSelections()"
>
<i
class=
"fa fa-search"
></i>
查询选择数据
</a>
<a
class=
"btn btn-primary"
onclick=
"getData()"
>
<i
class=
"fa fa-search"
></i>
获取所有数据
</a>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-12 select-table table-striped"
>
<table
id=
"bootstrap-table"
data-mobile-responsive=
"true"
></table>
</div>
</div>
</div>
<th:block
th:include=
"include :: footer"
/>
<th:block
th:include=
"include :: bootstrap-table-editable-js"
/>
<script
th:inline=
"javascript"
>
var
prefix
=
ctx
+
"demo/table"
;
var
datas
=
[[
$
{@
dict
.
getType
(
'sys_normal_disable'
)}]];
$
(
function
()
{
var
options
=
{
url
:
prefix
+
"/list"
,
showSearch
:
false
,
showRefresh
:
false
,
showToggle
:
false
,
showColumns
:
false
,
showPageGo
:
true
,
onEditableSave
:
onEditableSave
,
columns
:
[{
checkbox
:
true
},
{
field
:
'userId'
,
title
:
'用户ID'
},
{
field
:
'userCode'
,
title
:
'用户编号'
,
editable
:
true
},
{
field
:
'userName'
,
title
:
'用户姓名'
,
editable
:
true
},
{
field
:
'userPhone'
,
title
:
'用户手机'
,
editable
:
true
},
{
field
:
'userEmail'
,
title
:
'用户邮箱'
,
editable
:
true
},
{
field
:
'userBalance'
,
title
:
'用户余额'
},
{
field
:
'status'
,
title
:
'用户状态'
,
align
:
'center'
,
formatter
:
function
(
value
,
row
,
index
)
{
return
$
.
table
.
selectDictLabel
(
datas
,
value
);
}
},
{
title
:
'操作'
,
align
:
'center'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
actions
=
[];
actions
.
push
(
'<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> '
);
actions
.
push
(
'<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>'
);
return
actions
.
join
(
''
);
}
}]
};
$
.
table
.
init
(
options
);
});
function
onEditableSave
(
field
,
row
,
oldValue
,
$el
)
{
alert
(
"字段名:"
+
field
+
",当前值:"
+
row
[
field
]
+
",旧值:"
+
oldValue
);
}
/* 查询表格所有数据值 */
function
getData
(){
var
data
=
$
.
btTable
.
bootstrapTable
(
'getData'
);
alert
(
JSON
.
stringify
(
data
))
}
/* 查询表格选择行数据值 */
function
getSelections
(){
var
data
=
$
.
btTable
.
bootstrapTable
(
'getSelections'
);
alert
(
JSON
.
stringify
(
data
))
}
</script>
</body>
</html>
\ No newline at end of file
ruoyi-admin/src/main/resources/templates/include.html
View file @
c2e425aa
...
...
@@ -172,4 +172,13 @@
<div
th:fragment=
"bootstrap-table-reorder-js"
>
<script
th:src=
"@{/ajax/libs/bootstrap-table/extensions/reorder/bootstrap-table-reorder.js}"
></script>
<script
th:src=
"@{/ajax/libs/bootstrap-table/extensions/reorder/jquery.tablednd.js}"
></script>
</div>
<!-- 表格行内编辑插件 -->
<div
th:fragment=
"bootstrap-editable-css"
>
<link
th:href=
"@{/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.css}"
rel=
"stylesheet"
/>
</div>
<div
th:fragment=
"bootstrap-table-editable-js"
>
<script
th:src=
"@{/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js}"
></script>
<script
th:src=
"@{/ajax/libs/bootstrap-table/extensions/editable/bootstrap-table-editable.js}"
></script>
</div>
\ No newline at end of file
ruoyi-admin/src/main/resources/templates/index.html
View file @
c2e425aa
...
...
@@ -106,6 +106,7 @@
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/image}"
>
表格图片预览
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/curd}"
>
动态增删改查
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/reorder}"
>
表格拖拽操作
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/editable}"
>
表格行内编辑
</a></li>
<li><a
class=
"menuItem"
th:href=
"@{/demo/table/other}"
>
表格其他操作
</a></li>
</ul>
</li>
...
...
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