jquery - Using DataTable FixedColumns and JEditable together -



jquery - Using DataTable FixedColumns and JEditable together -

i'm posting question have never found solution while searching on internet, know others had had problem , wanted share solution.

the problem beingness whenever utilize datatable's fixedcolumns plugin

new $.fn.datatable.fixedcolumns(grid, { leftcolumns: 2, });

in conjunction jeditable find cannot edit frozen columns(ie here). sought provide solution explain in answer

the solution can found here, explain below

the problem exists because utilize of fixedcolumns creates 2 tables; 1 table, clone table(denoted class name dtfc_cloned , consists of columns wanted frozen. other table original table created. whenever seek edit, illustration uses inline editing, you're doing edit on original field not field created clone table.

the solution came allowed editing on clone table, force updated results original table. achieved adding fndawcallback fixedcolumns initialization. function have in there called every time fixedcolumns applied, every time after table redrawn.

new $.fn.datatable.fixedcolumns(grid, { leftcolumns: 3, fndrawcallback:function(){ clone_grid_init(); } });

the clone_grid_init()

//allows editing of fixed fields function clone_grid_init (){ $('.dtfc_cloned tbody tr').each(function(nrow){ $('td:gt(0)', this).addclass('edittext_clone'); //apply new class tds }); $('.edittext_clone').editable(thecallback, { indicator : "<img src='resources/images/indicator.gif'>", tooltip : "double click edit...", event : "dblclick", style : "inherit", submit : '<span class="fa fa-check"></span>', cancel : '<span class="fa fa-close"></span>', placeholder:"", callback : function (svalue, y){ var col = $(this).parent().children().index($(this));//get col index of field clone table var row = $(this).parent().parent().children().index($(this).parent());//get row index of field clone table //var apos = grid_clone.fngetposition( ); // position of current info node grid.fnupdate(svalue, row, col);// update original table new value homecoming svalue.trim(); //return new value clone table } }); };

jquery datatable jquery-datatables jeditable frozen-columns

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -