You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
joshuajeschek opened this issue
Nov 13, 2023
· 2 comments
Labels
coreIssues stemming from our compiled or source JavaScript files.featureIssues asking for a new feature to be added, or an existing one to be extended or modified.localeIssues regarding errors in locale extensions.
Since it is possible to set most functions throught data attributes, such as data-query-params for the table or data-formatter for columns, it should also be possible to set the methods for localization via data attributes.
The following should be possible:
<table
// other options ...
data-format-no-matches="formatNoMatches"
// ...
/>
functionformatNoMatches(){return'No matching records found.';}
However, this results in the following error:
Uncaught TypeError: this.options.formatNoMatches is not a function
bootstrap-table.min.js:10:104521
Another option is that you can override the default format option.
Object.assign($.fn.bootstrapTable.locales['en-US'],{formatNoMatches(){return'No matching records found.'}})Object.assign($.fn.bootstrapTable.defaults,$.fn.bootstrapTable.locales['en-US'])
I'm not sure how many users need to set the format with data-attribute, mark it as a feature first, and then consider implementing it into code if there are a large number of users who need it.
Thanks. It is a good option, but it doesn't quite apply to my usecase:
using the standard translations provided
overriding only formatNoMatches
since my application already uses a different tool for translation though, I am not reimplementing formatNoMatches for every language, but only once, accessing the tool in the override function.
wenzhixin
added
core
Issues stemming from our compiled or source JavaScript files.
locale
Issues regarding errors in locale extensions.
labels
Apr 11, 2024
coreIssues stemming from our compiled or source JavaScript files.featureIssues asking for a new feature to be added, or an existing one to be extended or modified.localeIssues regarding errors in locale extensions.
Description
Since it is possible to set most functions throught data attributes, such as
data-query-params
for the table ordata-formatter
for columns, it should also be possible to set the methods for localization via data attributes.The following should be possible:
However, this results in the following error:
The only way to set it currently is like this:
However, I am not using javascript to instantiate my table and i would like to keep it that way, keeping the configuration in the html data tags.
The text was updated successfully, but these errors were encountered: