追加新行时如何清除BootstrapTable输入数据

时间:2019-06-26 07:28:53

标签: javascript twitter-bootstrap bootstrap-table jquery-pagination

我正在使用bootstrapTable对表进行分页。每当我使用.bootstrapTable('append',data)时,所有输入数据都会被删除。这是bootstrapTable错误吗?该如何解决?

https://screencast-o-matic.com/watch/cq1OiUTPI9

function createTLUserRow(table) {
    var row = $('#'+table + ' tbody tr').length + 1;
    $("#"+table).bootstrapTable('append', {
        "0": ""+row,
        "1": '<input type="text" name="firstname[]" placeholder="First Name" class="form-control" required="">',
        "2": '<input type="text" name="lastname[]" placeholder="Last Name" class="form-control" required="">',
        "3": '<input type="text" name="state[]" placeholder="State" class="form-control" required="">',
        "4": '<div class="input-group"><input type="email" name="email[]" class="form-control" placeholder="Email address" required=""><input type="hidden" name="teamlink_key[]" class="form-control" placeholder="" value=""></div>',
        "5": '<span><button class="btn btn-danger delete_member_btn" type="button" data-table="add-table-0" data-row="row-1"><i class="fa fa-trash"></i></button></span>'
    });
    $("#"+table).css('display', 'table');
    removeDeleteButton(table);

    return row;
}

0 个答案:

没有答案