寻找和bootstrap有关的可编辑表格时候,找到这个插件skinnybrit51/editable-grid,感觉很好用,插件地址是https://github.com/skinnybrit51/editable-grid
代码也很简单,不过测试了两天,最后发现一个低级错误
var grid = new Grid({ // 这里 需要变成 var grid = new EditableGrid({ el: el, borders: false, columns: [ { id: 'a', title: 'a', width: '33.3%' }, { id: 'b', title: 'b', width: '33.3%' }, { id: 'c', title: 'c', width: '33.3%' } ], data: [ { id: 'id-1', a: 'a', b: 'b', c: 'c' }, { id: 'id-2', a: 'a', b: 'b', c: 'c' } ] }); grid.render();
引用文件有,
<link href="/Scripts/Bootstrap/bootstrap-3.1.1/bootstrap.min.css" rel="stylesheet"/>
<link href="/Scripts/Bootstrap/bootstrap-3.1.1/css/editable_grid.min.css" rel="stylesheet"/>
<script src="/Scripts/Bootstrap/bootstrap-3.1.1/jquery.min.js"></script>
<script src="/Scripts/Bootstrap/bootstrap-3.1.1/bootstrap.min.js"></script>
<script src="/Scripts/Bootstrap/bootstrap-3.1.1/js/editable_grid.min.js"></script>
除了支持bootstrap3之外,测试bootstrap4也是支持的,很好的插件,感谢作者 !