Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use a localization files and overwrite 1 localization function

I am trying to build a localized bootstrap-table.

<table class="table table-condensed table-bordered table-hover" 
    data-cache="false"
    data-show-footer="false"
    data-show-refresh="false" 
    data-show-toggle="false" 
    data-toggle="table"
     />
$('#table').bootstrapTable({
    locale :"nl-NL"
});

Everything works when I include the locale-file bootstrap-table-nl-NL.js

I want to overwrite the footer text showing the pagination text. In the documentation it says I need to define a function for formatShowingRows

There seems to be a problem using both locale and formatShowingRows

$('#table').bootstrapTable({
    locale :"nl-NL"
    formatShowingRows: function (pageFrom, pageTo, totalRows) {
        return 'Showing ' + pageFrom + ' to ' + pageTo + ' of ' + totalRows + ' rows';
    }
});

When I execute the above script. The pagination text is not replaced with the text I want. If I remove the locale. It does.

So it looks like locale and formatShowingRows are not compatible.

Any ideas ??

like image 320
Raymond Avatar asked Dec 06 '25 05:12

Raymond


1 Answers

You can use updateFormatText to change the messages BootstrapTable uses even (or especially) with localization. See https://live.bootstrap-table.com/code/wenzhixin/1640 for an example.

like image 124
Jochen Lutz Avatar answered Dec 09 '25 03:12

Jochen Lutz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!