1. 要先下.fn.dataTable.ext.errMode = 'none';

2. 再加入

.on('error.dt', function(e, settings, techNote, message) {
 console.log( 'An error has been reported by DataTables: ', message);
})

function 裡頭加入自訂內容

--

 

See the documentation -> http://datatables.net/reference/event/error

  1. error.dt was first introduced in 1.10.5 !! So you must use at least 1.10.5. Proof of concept : works not, 1.10.4 example / works, 1.10.5 example.

  2. The correct option to target is .fn.dataTable.ext.errMode.

  3. A working example would be using >1.10.4 and

.fn.dataTable.ext.errMode = 'none';
('#example').on('error.dt', function(e, settings, techNote, message) {
 console.log( 'An error has been reported by DataTables: ', message);
})

 

--

轉自 https://stackoverflow.com/questions/30283140/datatable-custom-error-handling-not-working

--

文章標籤
全站熱搜
創作者介紹
創作者 dizzy03 的頭像
dizzy03

碎碎念

dizzy03 發表在 痞客邦 留言(0) 人氣(2)