我在网站上使用datatable插件.
通常我每页只有1个数据表但在特殊显示器中我有2个数据表.
通常我每页只有1个数据表但在特殊显示器中我有2个数据表.
其实我有这个代码
var oTable = $('.datatable').dataTable({ 'sPaginationType':'full_numbers',"iDisplayLength": 50,"oLanguage": { "sUrl": "js/locales/dataTables.french.txt" } }); /* Add a click handler to the rows - this could be used as a callback */ $(".delete-ajax").click(function(event) { event.preventDefault(); var answer = confirm("Supprimer l'élément ?") if (answer){ var loading = $('.loading-notification'); loading.removeClass('hidden'); $(oTable.fnSettings().aoData).each(function (){ $(this.nTr).removeClass('row_selected'); }); $(event.target).parents('tr').addClass('row_selected'); var url = $(this).attr('href'); var id = $(this).attr('data-ajax'); var anSelected = fnGetSelected( oTable ); $.ajax({ type: "POST",url: url,data: "delete=true&id="+ id,async : true,success: function(msg) { loading.addClass('hidden'); oTable.fnDeleteRow( anSelected[0] ); } }); } }); /* Get the rows which are currently selected */ function fnGetSelected( oTableLocal ){ var aReturn = new Array(); var aTrs = oTableLocal.fnGetNodes(); for ( var i=0 ; i<aTrs.length ; i++ ){ if ( $(aTrs[i]).hasClass('row_selected') ){ aReturn.push( aTrs[i] ); } } return aReturn; }
当我只有1个数据表时,这个代码很有效,但是当我有更多数据表时,我在控制台中获得了
k is undefined [Stopper sur une erreur] h=a._iDisplayEnd;if(a.oFeatures.bServe...push(a.aoOpenRows[k].nTr)}}else{d[0]=
有关如何解决这个问题的任何想法?