@@ -6,7 +6,7 @@ function makeEditable() {
66 } ) ;
77
88 $ ( '.delete' ) . click ( function ( ) {
9- deleteRow ( $ ( this ) . attr ( "id" ) ) ;
9+ deleteRow ( $ ( this ) . closest ( 'tr' ) . attr ( "id" ) ) ;
1010 } ) ;
1111
1212 $ ( '#detailsForm' ) . submit ( function ( ) {
@@ -32,9 +32,10 @@ function deleteRow(id) {
3232
3333function enable ( chkbox ) {
3434 var enabled = chkbox . is ( ":checked" ) ;
35- chkbox . closest ( 'tr' ) . css ( "text-decoration" , enabled ? "none" : "line-through" ) ;
35+ var row = chkbox . closest ( 'tr' ) ;
36+ row . css ( "text-decoration" , enabled ? "none" : "line-through" ) ;
3637 $ . ajax ( {
37- url : ajaxUrl + chkbox . attr ( 'id' ) ,
38+ url : ajaxUrl + row . attr ( 'id' ) ,
3839 type : 'POST' ,
3940 data : 'enabled=' + enabled ,
4041 success : function ( ) {
@@ -44,17 +45,16 @@ function enable(chkbox) {
4445}
4546
4647function updateTableByData ( data ) {
47- oTable_datatable . fnClearTable ( ) ;
48+ datatableApi . clear ( ) ;
4849 $ . each ( data , function ( key , item ) {
49- oTable_datatable . fnAddData ( item ) ;
50+ datatableApi . row . add ( item ) ;
5051 } ) ;
51- oTable_datatable . fnDraw ( ) ;
52+ datatableApi . draw ( ) ;
5253 init ( ) ;
5354}
5455
5556function save ( ) {
5657 var form = $ ( '#detailsForm' ) ;
57- debugger ;
5858 $ . ajax ( {
5959 type : "POST" ,
6060 url : ajaxUrl ,
0 commit comments