1

削除確認モーダルが表示されないようにする方法はありますか?

私は持っている:

table.DataTable({
    dom: "Bfrtip",
    ajax: routes['customers.fetch'],
    order: [[1, 'desc']],
    language: global.config.config.dataTables.language,
    aoColumnDefs: [
        { targets: [7, 9], visible: false},
        { targets: [6], iDataSort: 7},
        { targets: [8], iDataSort: 9},
    ],
    columns: [
        {
            data: null,
            defaultContent: '',
            className: 'select-checkbox',
            orderable: false
        },
        { data: "id" },
        { data: "name" },
        { data: "email" },
        { data: "tel" },
        { data: "agent" },
        { data: "created_at", 'type': 'date', "dateFormat": "yy-mm-dd"},
        { data: "created_at" },
        { data: "last_order" },
        { data: "last_order_sort" },
        { data: "ltv", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) }
    ],
    select: {
        style:    'os',
        selector: 'td:first-child'
    },
    buttons: [
        { extend: "create", editor: editor },
        { extend: "edit",   editor: editor },
        { extend: "remove", editor: editor}
    ]
});
4

1 に答える 1

1

最後に、独自のカスタム削除関数を作成しました。

buttons: [
    ...
    {
        text: 'Delete',
        action: function (e, dt, node, config) {
            var selected = [];
            $('tbody', $table).find('tr.selected').each(function(i, v){
                selected.push($(v).attr('id').substr(4));
                $(v).css('opacity', 0.2);
            });
            if(selected.length > 0) {
                qwest.delete(routes['customers.delete'], {_token: $table.data('csrf'), selected: selected})
                    .then(function (xhr) {
                        $('#crm_table').DataTable().ajax.reload(null, false);
                    })
                    .catch(function(e){
                        modal('error', {msg: e.response});
                        $('tbody', $table).find('tr.selected').css('opacity', 1);
                        $('#crm_table tr').removeClass('selected');
                    })
            }
        }
    }
]
于 2016-01-17T06:40:36.137 に答える