jQuery Datatables 添加自定义表单元素
我有一个带有基本 init 的数据表设置。我希望能够在表格下方有复选框和提交按钮。有没有办法自定义表格下方的信息“行”?
如果我只是在表格后面添加提交按钮,这就是它的样子
这就是我想要的样子
我需要一个解决 Javascript 开启或关闭的解决方案。
I have datatables setup with a basic init. I want to be able to have checkboxes and a submit button below the table. Is there any way to customize the information "row" below the table?
This is what it looks like if I just add the submit button after the table
This is what I want it to look like
I need a solution that accounts for Javascript being on or off.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您对关闭 Javascript 的解决方案的要求是不可能的,因为只有在初始化 DataTable 时才会生成信息行。
信息行包装在 div 标签中,该标签根据初始化表的 ID 获取其 ID。
例如,如果您的表是这样声明的:
信息行将在您的 DOM 中显示为
:要将“删除”按钮添加到信息行前面,您需要在每次呈现表时使用 fnDrawCallback 来包含该按钮。
Your requirement for a solution that accounts for Javascript being turned off is not possible because the information row is generated only when you initialize the DataTable.
The information row is wrapped in a div tag that gets its ID based off of the ID of the initialized table.
For example, if your table was declared like this:
The information row would appear in your DOM as this
To prepend the 'delete' button to your information row, you need to use fnDrawCallback to include the button each time the table is rendered.