EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jega on January 19, 2026, 04:19:34 AM



Title: [SOLVED]Change locale dynamic
Post by: jega on January 19, 2026, 04:19:34 AM
Hi

Have an combobox with locale and a datagrid

      <input id="countryCode" name="countryCode" class="easyui-combobox" style="width:200px" data-options="
          valueField: 'countryCode',
          textField: 'countryName',
          editable: false,
          data:[
             {'countryName':'Danish','countryCode':'da'},
             {'countryName':'English','countryCode':'en'}
          ],
          onClick: function(rec){
             loadLocale(rec.countryCode);
          }">


How can i set the language in loadLocale function

Have tried a lot of things, but with no luck.

When i load <script src="easyui/easyloader.js"></script> and use easyloader.locale = 'da' in the document ready, it works, but not in loadLocale.

However, if i load easyloader.js then the datagrid on the site is now without filter. Just remove the script tag then filter is back.


Any help





Title: Re: Change locale dynamic
Post by: jarry on January 26, 2026, 11:55:00 PM
Please try the 'loadLocale' function definition.

Code:
function loadLocale(countryCode) {
const url = 'https://www.jeasyui.com/easyui/locale/easyui-lang-' + countryCode + '.js';
$.getScript(url, () => {
$('.pagination').each(function () {
var opts = $(this).pagination('options');
opts.beforePageText = $.fn.pagination.defaults.beforePageText;
opts.afterPageText = $.fn.pagination.defaults.afterPageText;
opts.displayMsg = $.fn.pagination.defaults.displayMsg;
$(this).pagination();
});
$('.datagrid-f').each(function () {
var opts = $(this).datagrid('options');
opts.loadMsg = $.fn.datagrid.defaults.loadMsg;
})
})
}


Title: Re: Change locale dynamic
Post by: jega on February 10, 2026, 03:03:39 PM
Works fine

Is there other things that i miss in not using easyloader.js ??