2016-10-27 17 views
1

Tablesorterゼブラが機能していない行を削除した後

$(function() { 
 

 
    // NOTE: $.tablesorter.theme.bootstrap is ALREADY INCLUDED in the jquery.tablesorter.widgets.js 
 
    // file; it is included here to show how you can modify the default classes 
 
    $.tablesorter.themes.bootstrap = { 
 
    // these classes are added to the table. To see other table classes available, 
 
    // look here: http://getbootstrap.com/css/#tables 
 
    table  : 'table table-bordered table-striped', 
 
    caption  : 'caption', 
 
    // header class names 
 
    header  : 'bootstrap-header', // give the header a gradient background (theme.bootstrap_2.css) 
 
    sortNone  : '', 
 
    sortAsc  : '', 
 
    sortDesc  : '', 
 
    active  : '', // applied when column is sorted 
 
    hover  : '', // custom css required - a defined bootstrap style may not override other classes 
 
    // icon class names 
 
    icons  : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header 
 
    iconSortNone : 'bootstrap-icon-unsorted', // class name added to icon when column is not sorted 
 
    iconSortAsc : 'glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort 
 
    iconSortDesc : 'glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort 
 
    filterRow : '', // filter row class; use widgetOptions.filter_cssFilter for the input/select element 
 
    footerRow : '', 
 
    footerCells : '', 
 
    even   : '', // even row zebra striping 
 
    odd   : '', // odd row zebra striping 
 
    sortMultiSortKey: 'shiftKey', 
 
    
 
    }; 
 
    
 
    $('#resetsort').click(function(e) { 
 
    $("#receipts").trigger('sortReset').trigger('applyWidgets'); 
 
    return false; 
 
    }); 
 
    
 
    
 
    // call the tablesorter plugin and apply the uitheme widget 
 
    $("#receipts").tablesorter({ 
 
    // this will apply the bootstrap theme if "uitheme" widget is included 
 
    // the widgetOptions.uitheme is no longer required to be set 
 
    theme : "blue", 
 
    
 
    widthFixed: true, 
 
    
 

 
    headerTemplate : '{content} {icon}', // new in v2.7. Needed to add the bootstrap icon! 
 

 
    // widget code contained in the jquery.tablesorter.widgets.js file 
 
    // use the zebra stripe widget if you plan on hiding any rows (filter widget) 
 
    widgets : [ "uitheme", "filter", "zebra" ], 
 

 
    widgetOptions : { 
 
     // using the default zebra striping class name, so it actually isn't included in the theme variable above 
 
     // this is ONLY needed for bootstrap theming if you are using the filter widget, because rows are hidden 
 
     zebra : ["even", "odd"], 
 

 
     // reset filters button 
 
     filter_reset : ".reset", 
 

 
     // extra css class name (string or array) added to the filter element (input or select) 
 
     filter_cssFilter: "form-control", 
 

 
     // set the uitheme widget to use the bootstrap theme class names 
 
     // this is no longer required, if theme is set 
 
     // ,uitheme : "bootstrap" 
 

 
    } 
 
    }) 
 
    .tablesorterPager({ 
 

 
    // target the pager markup - see the HTML block below 
 
    container: $(".ts-pager"), 
 

 
    // target the pager page select dropdown - choose a page 
 
    cssGoto : ".pagenum", 
 

 
    // remove rows from the table to speed up the sort of large tables. 
 
    // setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled. 
 
    removeRows: false, 
 

 
    // output string - default is '{page}/{totalPages}'; 
 
    // possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} 
 
    output: '{startRow} - {endRow}/{filteredRows} ({totalRows})' 
 

 
    }); 
 

 
}); 
 
    
 
function yeah() { 
 
    return confirm('Are you sue you want to delete?'); 
 
    $("#receipts").trigger('applyWidgets'); 
 
    return false; 
 
}

こんにちは、

初心者ここフィルター&ソートしてもTablesorterを実行しています。すべてが完全に動作します(リセットボタンを含む)。背景のビットとして、データの行を配信するモジュールでDotNet Nukeサイトを使用しています。

各行の一部は、行の削除を開始するハイパーリンクです。また、私はいくつかのJavaScriptを挿入することができるセクションを含んでいます。

問題が行を削除すると、zebraウィジェットが機能しません。 (すべての行は白です)

削除ハイパーリンクの他の部分は、それは確かにメッセージが表示されますか?

2つのアクションを実行する必要があるため、ここでは関数を作成することをお勧めします。

機能ええ、私の試みです。このページには、正常に機能するresetsortボタンもあります。

Iveは私の機能をresetsortボタンのすぐ下に置いてみましたが、それは効果がありませんでした。

この機能を利用するにあたり、事前にお礼を申し上げます。

+0

ちょうどチェックインしてください:) – Todd

+0

これは、ページリフレッシュが発生していない状態で更新されているパネルと関係があると思われます。どんな支援も感謝して受け入れます – Todd

+0

'yeah'関数はすぐに' confirm'関数を返しています...その戻り値以下のコードは無視されます。 – Mottie

答えて

0

sortResetメソッドは、適用後にウィジェットを自動的に更新する必要があります。この場合、なぜそれが起こっているのかわかりません。

とにかく、"sortReset"がトリガーされると処理が必要になるため、すぐに「applyWidgets」を使用すると遅延が必要になるため、すぐに動作しません。私はいくつかの自由な時間を得るとき、これは内部で起きていない理由を把握しようとするでしょう

$("#receipts").trigger('sortReset', [function(){ 
    $('#receipts').trigger('applyWidgets'); 
}]); 

「sortReset」トリガーは、コールバックを含めるので、このコードを試してみてくださいません。

関連する問題