I need to get list of categories (not modx categories) from migxdb table and put this list into migxTV. Here is the schema of this table:
configuration - prices_analizy_categories.
{
"formtabs":[
{
"MIGX_id":8,
"caption":"\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":37,
"field":"active",
"caption":"\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"\u0412\u044b\u043a\u043b==0||\u0412\u043a\u043b==1",
"default":0,
"useDefaultIfEmpty":1,
"pos":1
},
{
"MIGX_id":38,
"field":"category",
"caption":"",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":2
}
],
"pos":1
}
],
"contextmenus":"",
"actionbuttons":"",
"columnbuttons":"",
"filters":"",
"extended":{
"migx_add":"",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"prices_analizy_categories",
"maxRecords":"",
"addNewItemAt":"bottom",
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"",
"filtersperrow":4,
"packageName":"",
"classname":"",
"task":"",
"getlistsort":"",
"getlistsortdir":"",
"sortconfig":"",
"gridpagesize":"",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":1,
"check_resid":1,
"check_resid_TV":"",
"join_alias":"",
"has_jointable":"yes",
"getlistwhere":"",
"joins":"",
"hooksnippets":"",
"cmpmaincaption":"",
"cmptabcaption":"",
"cmptabdescription":"",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":122,
"header":"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435",
"dataIndex":"category",
"width":400,
"sortable":1,
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":104,
"header":"\u0410\u043a\u0442\u0438\u0432\u043d\u043e",
"dataIndex":"active",
"width":100,
"sortable":"false",
"show_in_grid":1,
"renderer":"this.renderSwitchStatusOptions",
"clickaction":"switchOption",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":[
{
"MIGX_id":101,
"name":"\u0412\u043a\u043b",
"value":1,
"clickaction":"",
"handler":"",
"image":"assets\/components\/migx\/style\/images\/tick.png"
},
{
"MIGX_id":102,
"name":"\u0412\u044b\u043a\u043b",
"value":0,
"clickaction":"",
"handler":"",
"image":"assets\/components\/migx\/style\/images\/cross.png"
},
{
"MIGX_id":103,
"name":"\u0412\u044b\u043a\u043b",
"use_as_fallback":1,
"value":0,
"clickaction":"",
"handler":"",
"image":"assets\/components\/migx\/style\/images\/cross.png"
}
],
"editor":""
}
]
}
Then I need to get JSON-array with MIGX_id field in chunk getCategoriesAnalizy. Snippet migxLoopCollection returns data in JSON format without MIGX_id field. I decide to write own snippet which adds MIGX_id field to output array. So, in chunk getCategoriesAnalizy I call addMigxId snippet:
When I load resource with this TV in manager, it show me correct grid. But when I click active icon in grid - nothing happens and I have error message in console:
It is strange, because when I get JSON in chunk with getImageLList snippet (another TV) it works correctly.