This commit is contained in:
TarekNabil 2023-04-21 18:29:44 +02:00
parent e92b607081
commit 5d82365ec1
1 changed files with 4 additions and 5 deletions

View File

@ -18,8 +18,7 @@
$table = $( '.wc_tax_rates' ), $table = $( '.wc_tax_rates' ),
$tbody = $( '#rates' ), $tbody = $( '#rates' ),
$save_button = $( ':input[name="save"]' ), $save_button = $( ':input[name="save"]' ),
$pagination = $( '#rates-pagination' ), $pagination = $( '#rates-pagination, #rates-bottom-pagination' ),
$bottom_pagination = $( '#rates-bottom-pagination' ),
$search_field = $( '#rates-search .wc-tax-rates-search-field' ), $search_field = $( '#rates-search .wc-tax-rates-search-field' ),
$submit = $( '.submit .button-primary[type=submit]' ), $submit = $( '.submit .button-primary[type=submit]' ),
WCTaxTableModelConstructor = Backbone.Model.extend({ WCTaxTableModelConstructor = Backbone.Model.extend({
@ -122,8 +121,8 @@
this.listenTo( this.model, 'saved:rates', this.clearUnloadConfirmation ); this.listenTo( this.model, 'saved:rates', this.clearUnloadConfirmation );
$tbody.on( 'change autocompletechange', ':input', { view: this }, this.updateModelOnChange ); $tbody.on( 'change autocompletechange', ':input', { view: this }, this.updateModelOnChange );
$search_field.on( 'keyup search', { view: this }, this.onSearchField ); $search_field.on( 'keyup search', { view: this }, this.onSearchField );
$pagination.add($bottom_pagination).on( 'click', 'a', { view: this }, this.onPageChange ); $pagination.on( 'click', 'a', { view: this }, this.onPageChange );
$pagination.add($bottom_pagination).on( 'change', 'input', { view: this }, this.onPageChange ); $pagination.on( 'change', 'input', { view: this }, this.onPageChange );
$( window ).on( 'beforeunload', { view: this }, this.unloadConfirmation ); $( window ).on( 'beforeunload', { view: this }, this.unloadConfirmation );
$submit.on( 'click', { view: this }, this.onSubmit ); $submit.on( 'click', { view: this }, this.onSubmit );
$save_button.prop( 'disabled', true ); $save_button.prop( 'disabled', true );
@ -174,7 +173,7 @@
if ( qty_pages > 1 ) { if ( qty_pages > 1 ) {
// We've now displayed our initial page, time to render the pagination box. // We've now displayed our initial page, time to render the pagination box.
$pagination.add($bottom_pagination).html( paginationTemplate( { $pagination.html( paginationTemplate( {
qty_rates: qty_rates, qty_rates: qty_rates,
current_page: this.page, current_page: this.page,
qty_pages: qty_pages qty_pages: qty_pages