bootstrap-table 表格行内编辑实现


当前第2页 返回上一页

通过bootstrap table自带的 onClickCell 方法,点击 td 添加 contenteditable 属性(ps: 使元素可编辑),于是 td 元素具有了类似于文本框的 focus 和 blur 事件,用户点击 td 获取焦点,编辑完内容失去焦点后,调用 updateCell方法更新单元格数据。

引入

1

2

3

4

5

6

<link rel="stylesheet" type="text/css" href="js/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css" />

   <link rel="stylesheet" type="text/css" href="js/bootstrap-table/1.12.1/bootstrap-table.min.css" />

   <script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>

   <script src="js/bootstrap/bootstrap-3.3.7-dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>

   <script src="js/bootstrap-table/1.12.1/bootstrap-table.min.js" type="text/javascript" charset="utf-8"></script>

   <script src="js/bootstrap-table/1.12.1/locale/bootstrap-table-zh-CN.min.js" type="text/javascript" charset="utf-8"></script>

json

1

2

3

4

5

[

    { "id": 1, "name": "Item 1", "price": "¥1" },

    { "id": 2, "name": "Item 2", "price": "¥2" },

    { "id": 3, "name": "Item 3", "price": "¥3" }

]

以上就是bootstrap-table 表格行内编辑实现的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

bootstrap 怎么设置字体颜色

springboot怎么用bootstrap

bootstrap-switch如何设置初始值

bootstrap 不支持ie怎么办

html中表格tr的td单元格怎么设置宽度属性

div和table在网站中的可用性比较

为什么要使用bootstrap

bootstrap响应式布局图片怎么居中

简述为什么要使用bootstrap,有什么优点

bootstrap怎么删除图标

更多相关阅读请进入《bootstrap》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...