table的代理方法 删除cell可编辑状态

-( void )tableView:( UITableView *)tableView commitEditingStyle:( UITableViewCellEditingStyle )editingStyle forRowAtIndexPath:( NSIndexPath *)indexPath{
   
//self.navigationItem.rightBarButtonItem  = self.editButtonItem;这句话放到viewdidload里
    if (editingStyle == UITableViewCellEditingStyleDelete ) {
        [
self . DataArray removeObjectAtIndex :indexPath. row ];
        [
self . tableView setEditing : NO animated : YES ];
        [tableView
reloadData ];
    }

}
好的,关于 Bootstrap 表格的行编辑状态,我可以给您进行详细介绍。 首先,Bootstrap Table 是一个基于 Bootstrap 的扩展,可以让表格更加美观、功能更加丰富。其中,双击可编辑、添加、删除行的功能可以通过插件实现。 具体实现步骤如下: 1. 引入必要的文件 ``` <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.css"> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.js"></script> <script src="https://cdn.bootcss.com/bootstrap-table/1.12.1/extensions/editable/bootstrap-table-editable.min.js"></script> ``` 2. 准备表格数据 ``` var data = [ {id: 1, name: '张三', age: 20}, {id: 2, name: '李四', age: 25}, {id: 3, name: '王五', age: 30} ]; ``` 3. 定义表格 ``` <table id="table" data-editable="true"> <thead> <tr> <th data-field="id">ID</th> <th data-field="name">姓名</th> <th data-field="age">年龄</th> <th data-field="operate" data-formatter="operateFormatter" data-events="operateEvents">操作</th> </tr> </thead> </table> ``` 其中,`data-editable="true"` 表示表格可编辑。 4. 初始化表格 ``` $(function () { $('#table').bootstrapTable({ data: data }); }); ``` 5. 定义操作列的格式化函数 ``` function operateFormatter(value, row, index) { return [ '<a class="edit" href="javascript:void(0)" title="编辑">', '<i class="glyphicon glyphicon-edit"></i>', '</a> ', '<a class="remove" href="javascript:void(0)" title="删除">', '<i class="glyphicon glyphicon-remove"></i>', '</a>' ].join(''); } ``` 6. 定义操作列的事件处理函数 ``` window.operateEvents = { 'click .edit': function (e, value, row, index) { // 编辑事件 $('#table').bootstrapTable('beginEditRow', index); }, 'click .remove': function (e, value, row, index) { // 删除事件 $('#table').bootstrapTable('remove', { field: 'id', values: [row.id] }); } }; ``` 7. 定义保存按钮的事件处理函数 ``` $('#save').click(function () { // 保存事件 $('#table').bootstrapTable('endAllEdit'); }); ``` 以上就是实现 Bootstrap 表格行编辑状态的详细步骤。需要注意的是,具体实现可能会因为版本的不同而有所差异,以上代码仅供参考。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值