Hello everybody again,
This week I have created a countryrenderer for MIGX based on key. I am using the country list in the lexicon. This component becomes particularly useful when developing multilingual website. My code is still a little bit glitchy though.
The moment I have more than one element in the grid the countries dont show up.
I am sure you guys could help me improve the code has I dont know extjs.
$_country_lang = array();
include $this->modx->getOption('core_path').'lexicon/country/en.inc.php';
$countrylist=json_encode($_country_lang);
$renderer['this.renderCountry'] = "
renderCountry : function(val, md, rec, row, col, s){
var countryJson='{$countrylist}';
//Stripping the JSON message
countryJson=countryJson.replace('{','');
countryJson=countryJson.replace('}','');
countryJson=countryJson.replace(/\"/gi,'');
var countryArray =countryJson.split(',');
for(var country=0; i<countryArray.length; i++){
var countryObj=countryArray[i].split(':');
if(countryObj[0]==val){
return(countryObj[1]);
}
}
return '';
}
";
Thanks