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有什么优点

bootstrap框架怎么自适应手机

bootstrap的组件有哪些?

bootstrap table使用方法汇总

解决bootstrap只加载一次 remote 数据的问题

bootstrap框架的好处

bootstrap模态框怎么关闭事件

bootstrap怎么实现分页技术

为什么前端不用bootstrap

bootstrap是不是js库

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




打赏

取消

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

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

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

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

评论

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