Во время изучения migx и migxdb столкнулся с проблемой рендеринга миниатюры изображения со своим источником файлов.
Суть проблемы в следующем.
Я создал свои объекты с таблицами по этой инструкции Инструкция от Пана Евгениуса
Помимо простых текстовых полей я добавил еще поле типа image cо своим источником файлов. Изображение корректно отображается при добавлении элемента, но не показывается миниатюра в таблице.
Посмотрев в код я заметил, что при рендеринге изображения в таблице проставляется неверный id источника файлов. Вместо 2 ставит 1.
При использовании inputTV вместо inputTVtype картина такая же.
Если использовать этот же конфиг но в обычном TV и вызывать его в дополнительных полях ресурса то изображение рендерится корректно.
Вопрос. Почему так происходит? Можно ли где-то в конфиге migx задать источник по умолчанию? В интернете информации по данному глюку найти не смог.
Это путь изображения в форме добавления элемента:
src="/connectors/system/phpthumb.php?h=60&src=photo/ivanovii.jpg&source=2"А это путь в таблице
src="/connectors/system/phpthumb.php?h=60&src=photo/ivanovii.jpg&source=1"Скриншоты:
Изображение в форме добавления элемента
Сравнение путей к изображению в форме и в таблице
Конфиг migx:
{
"formtabs":[
{
"MIGX_id":1,
"caption":"Info",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":1,
"field":"surname",
"caption":"\u0424\u0430\u043c\u0438\u043b\u0438\u044f",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
},
{
"MIGX_id":2,
"field":"name",
"caption":"\u0418\u043c\u044f",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":2
},
{
"MIGX_id":3,
"field":"secname",
"caption":"\u041e\u0442\u0447\u0435\u0441\u0442\u0432\u043e",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":3
},
{
"MIGX_id":4,
"field":"position",
"caption":"\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"@SELECT '' AS `name` ,'' AS `id` FROM `[[+PREFIX]]pb_positions` UNION SELECT `name`,`id` FROM `[[+PREFIX]]pb_positions` WHERE `deleted` = 0",
"default":"",
"useDefaultIfEmpty":"0",
"pos":4
},
{
"MIGX_id":5,
"field":"department",
"caption":"\u041e\u0442\u0434\u0435\u043b",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"@SELECT '' AS `name` ,'' AS `id` FROM `[[+PREFIX]]pb_departments` UNION SELECT `name`,`id` FROM `[[+PREFIX]]pb_departments` WHERE `deleted` = 0",
"default":"",
"useDefaultIfEmpty":"0",
"pos":5
},
{
"MIGX_id":6,
"field":"filial",
"caption":"\u0424\u0438\u043b\u0438\u0430\u043b",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"@SELECT '' AS `name` ,'' AS `id` FROM `[[+PREFIX]]pb_filials` UNION SELECT `name`,`id` FROM `[[+PREFIX]]pb_filials` WHERE `deleted` = 0",
"default":"",
"useDefaultIfEmpty":"0",
"pos":6
},
{
"MIGX_id":7,
"field":"cabinet",
"caption":"\u041a\u0430\u0431\u0438\u043d\u0435\u0442",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"001||002||003||005||006||007",
"default":"",
"useDefaultIfEmpty":"0",
"pos":7
},
{
"MIGX_id":8,
"field":"phone",
"caption":"\u0422\u0435\u043b\u0435\u0444\u043e\u043d",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"migx",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":8
},
{
"MIGX_id":9,
"field":"email",
"caption":"Email",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"email",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":9
},
{
"MIGX_id":10,
"field":"bday",
"caption":"\u0414\u0430\u0442\u0430 \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f",
"description":"",
"description_is_code":"0",
"inputTV":"date",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":10
},
{
"MIGX_id":11,
"field":"photo",
"caption":"\u0424\u043e\u0442\u043e",
"description":"500x700px",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"Image",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":[
{
"MIGX_id":1,
"context":"web",
"sourceid":2
}
],
"inputOptionValues":"",
"default":"nophoto",
"useDefaultIfEmpty":1,
"pos":11
}
],
"pos":1
}
],
"contextmenus":"update||recall_remove_delete||remove",
"actionbuttons":"addItem||toggletrash",
"columnbuttons":"",
"filters":[
{
"MIGX_id":1,
"name":"search",
"label":"\u0424\u0430\u043c\u0438\u043b\u0438\u044f",
"emptytext":"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0444\u0430\u043c\u0438\u043b\u0438\u044e",
"type":"textbox",
"getlistwhere":{
"surname:LIKE":"%[[+search]]%"
},
"getcomboprocessor":"",
"combotextfield":"",
"comboidfield":"",
"combowhere":"",
"comboclassname":"",
"combopackagename":"",
"combo_use_custom_prefix":"0",
"comboprefix":"",
"combojoins":"",
"comboparent":"",
"default":""
}
],
"extended":{
"migx_add":"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"staff",
"maxRecords":"",
"addNewItemAt":"bottom",
"media_source_id":2,
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"",
"filtersperrow":4,
"packageName":"phonebook",
"classname":"pbStaff",
"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":[
{
"alias":"Department",
"selectfields":"name"
},
{
"alias":"Position",
"selectfields":"name"
},
{
"alias":"Filial",
"selectfields":"name"
}
],
"hooksnippets":"",
"cmpmaincaption":"\u0411\u0414 \"\u0421\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0438 \u041d\u0422\u0426 \u041f\u0440\u043e\u043c\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\"",
"cmptabcaption":"\u0421\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0438",
"cmptabdescription":"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"id",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":"0",
"customrenderer":"",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":5,
"header":"\u0424\u043e\u0442\u043e",
"dataIndex":"photo",
"width":"",
"sortable":"false",
"show_in_grid":1,
"customrenderer":"",
"renderer":"this.renderImage",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":2,
"header":"\u0424\u0418\u041e",
"dataIndex":"fio",
"width":"",
"sortable":"false",
"show_in_grid":1,
"customrenderer":"",
"renderer":"this.renderChunk",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"[[+surname]] [[+name]] [[+secname]]",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":3,
"header":"\u0414\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c",
"dataIndex":"Position_name",
"width":"",
"sortable":true,
"show_in_grid":1,
"customrenderer":"",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":4,
"header":"\u041e\u0442\u0434\u0435\u043b",
"dataIndex":"Department_name",
"width":"",
"sortable":"false",
"show_in_grid":1,
"customrenderer":"",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
}
]
}
Комментарии (0)