Posted 31 January 2025, 5:31 am EST
- Updated 31 January 2025, 5:36 am EST
Hi,
You can override the internal API getCultureInfoDict method to rearrange the cultures displayed in the dropdown list. Below is a sample code snippet to achieve this:
// Override the getCultureInfoDict method
var oldFn = GC.Spread.Common.CultureManager.getCultureInfoDict;
GC.Spread.Common.CultureManager.getCultureInfoDict = function () {
var cultureDic = oldFn.apply(this, arguments);
var orderedCultureDic = {};
// 1. Add prioritized cultures first
if (cultureDic['en-gb']) {
orderedCultureDic['en-gb'] = cultureDic['en-gb'];
}
if (cultureDic['fr-fr']) {
orderedCultureDic['fr-fr'] = cultureDic['fr-fr'];
}
// 2. Add remaining cultures in the original order
for (var key in cultureDic) {
if (key !== 'en-gb' && key !== 'fr-fr') {
orderedCultureDic[key] = cultureDic[key];
}
}
return orderedCultureDic;
};
Please note:
- Even after modifying the order, SpreadJS prioritizes its current culture setting. Ensure you update the default culture accordingly:
GC.Spread.Common.CultureManager.culture('en-gb');
- The “None” option will always appear first in the dropdown as this is part of the design and cannot be changed.
In the example attached , the “en-gb” culture is prioritized and appears at the top. SpreadJS Designer will apply the culture settings based on the current SpreadJS culture.
Feel free to reach out if you encounter any issues.
Regards,
Ankit
Sample: CultureCustomizations.zip