尝试重绘表格。 单击图标时需要重绘表格。没有错误,但在第二次单击删除图标时更新表。
问题是什么?`
var $ = jQuery = require('jquery');
var dataTable = require('../bower/datatables.net/js/jquery.dataTables.js');
$.DataTable = dataTable;
var App = {
InitUsertable: null, //Table of users
mestype: null,
init: function () {
this._initHandler();
console.log('init dTable');
this._initDtDefaultSettings();
this.InitUserTable();
this.InitProductTable();
this.InitCostTable();
this.InitMestypeTable();
},
_initHandler: function () {
$(document).on('click', '#delete', this.InitButtons.bind(this));
},
_initDtDefaultSettings: function () {
$.extend(true, $.fn.dataTable.defaults, {
"lengthMenu": [10, 25, 50, 75, 100, 200],
"oLanguage": {
"sProcessing": false,
"sLengthMenu": "Показывать _MENU_ строк",
"sZeroRecords": "Ничего не найдено",
"sInfo": "Показано с _START_ по _END_ из _TOTAL_ строк",
"sInfoEmtpy": "Показано с 0 по 0 из 0 строк",
"sInfoFiltered": "(выбрано из _MAX_)",
"sInfoPostFix": "",
"sSearch": "Поиск: ",
"sUrl": "",
"sEmptyTable": "Ничего не найдено",
"oPaginate": {"sFirst": "First", "sLast": "Last", "sNext": "Следующая", "sPrevious": "Предыдущая"},
"sInfoEmpty": "Показано с 0 по 0 из 0 строк",
"sLoadingRecords": "loading..."
},
"serverSide": true,
"bProcessing": false,
"bDeferRender": true,
"bAutoWidth": false,
"bFilter": true,
"bInfo": true,
"bSortClasses": true,
"bStateSave": true
})
},
InitMestypeTable: function () {
if ($('#mestypeTable').length != 0) {
var _this = this;
var urlAll = 'http://' + window.location.hostname + '/mestype';
_this.mestypeTable = $('#mestypeTable').DataTable({
"processing": true,
"serverSide": true,
"ajax": {url: urlAll, type: 'GET'},
"order": [[0, "desc"]],
"columns": [
{data: "id", "orderable": false, render:
function (data, type, row)
{
return data;
}},
{data: "name", "orderable": false, render:
function (data, type, row)
{
return data;
}
},
{data: "short_name", "orderable": false, render:
function (data, type, row)
{
return data;
}
},
{data: "edit", "orderable": false, render:
function (data, type, row)
{
return '<a href="/admin/edit-mestype?id=' + data + '" data-toggle="ajaxModal"><i class="fa fa-edit"></i></a>';
}
},
{data: "delete", "orderable": false, render:
function (data, type, row)
{
return '<a href="/mestypes/' + data + '" data-method= "delete" id="delete"><i class="fa fa-trash-o"></i></a>';
}
},
],
});
}
;
},
InitButtons: function () {
App.mestypeTable.draw();
},
};
module.exports = App;
`
答案 0 :(得分:2)
试试这个:
function force_stop_managed_servers () {
printf "\n\n:: INFO :: $0 :: `date +%Y-%m-%d:%H:%M:%S` :force_stop_managed_servers called"
cd $SCRIPT_DIR
kill -9 $(ps -ef | grep SONARPOTY | grep $USER | grep -v "grep" | grep -v "StopManagedServers" | grep -v "controller"| awk '{ print $2 }')
printf "\n\n:: INFO :: $0 :: `date +%Y-%m-%d:%H:%M:%S` :force_stop_managed_servers done"
}