EasyUI Forum
January 27, 2026, 09:31:16 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Change locale dynamic  (Read 6028 times)
jega
Full Member
***
Posts: 237


View Profile
« 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



Logged
jarry
Administrator
Hero Member
*****
Posts: 2306


View Profile Email
« Reply #1 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;
})
})
}
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!