Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getImageList where filter not working with default field values #397

Open
DmitryFX opened this issue Jun 19, 2022 · 2 comments
Open

getImageList where filter not working with default field values #397

DmitryFX opened this issue Jun 19, 2022 · 2 comments

Comments

@DmitryFX
Copy link

DmitryFX commented Jun 19, 2022

After uploading images:
[visible_in_slider] and [visible_on_page] params are stored in a strange way, so getImageList doesn't find them.

Use Default if Empty is set to "YES"
Fallback values are set, so everything looks right in the UI.

This shows no results:

[[!getImageList?
&docid=`3`
&tvname=`migx_photo_uploads`
&limit=`10`
&where=`{"visible_on_page:=":"1"}`
]]
Array
(
    [MIGX_id] => 1
    [image] => assets/uploads/3/img-8583.JPG
    [deleted] => 0
    [published] => 1
    [visible_in_slider_ro] => {"MIGX_id":"3","name":"0","use_as_fallback":"1","value":"use_as_fallback","clickaction":"switchOption","handler":"","image":"assets\/img\/icons\/no.png","idx":0,"_renderer":"this.renderSwitchStatusOptions","selectorconfig":""}
    [visible_on_page_ro] => {"MIGX_id":"3","name":"1","use_as_fallback":"1","value":"use_as_fallback","clickaction":"switchOption","handler":"","image":"assets\/img\/icons\/yes.png","idx":0,"_renderer":"this.renderSwitchStatusOptions","selectorconfig":""}
    [_alt] => 0
    [_first] => 1
    [_last] => 1
    [idx] => 1
    [property.docid] => 3
    [property.tvname] => migx_photo_uploads
    [property.limit] => 10
)

After ticking-unticking [visible_in_slider] and [visible_on_page] in the interface and saving the document:

The snipppet call from above works as expected, because [visible_in_slider] and [visible_on_page] now exist.

Array
(
    [MIGX_id] => 1
    [image] => assets/uploads/3/img-8583.JPG
    [deleted] => 0
    [published] => 1
    [visible_in_slider_ro] => {"MIGX_id":"4","name":"0","use_as_fallback":"","value":"0","clickaction":"switchOption","handler":"","image":"assets/img/icons/no.png","idx":2,"_renderer":"this.renderSwitchStatusOptions","selectorconfig":"","tv_type":"migx"}
    [visible_on_page_ro] => {"MIGX_id":"1","name":"1","use_as_fallback":"","value":"1","clickaction":"switchOption","handler":"","image":"assets/img/icons/yes.png","idx":2,"_renderer":"this.renderSwitchStatusOptions","selectorconfig":"","tv_type":"migx"}
    [visible_in_slider] => 0
    [visible_on_page] => 1
    [_alt] => 0
    [_first] => 1
    [_last] => 1
    [idx] => 1
    [property.docid] => 3
    [property.tvname] => migx_photo_uploads
    [property.limit] => 10
)

I'm not sure if it is getImageList problem or it's about setting the default parameters on upload. Please, investigate this.

@DmitryFX
Copy link
Author

DmitryFX commented Jun 19, 2022

And some value mismatch right after uploading images. Columns - right, editor - incorrect values.

image

@DmitryFX
Copy link
Author

DmitryFX commented Jun 19, 2022

My config. Nothing special.

{ "formtabs":[ { "MIGX_id":1, "caption":"\u0424\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438", "print_before_tabs":"0", "fields":[ { "MIGX_id":1, "field":"image", "caption":"\u0424\u043e\u0442\u043e", "description":"", "description_is_code":"0", "inputTV":"", "inputTVtype":"image", "validation":"", "configs":"", "restrictive_condition":"", "display":"", "sourceFrom":"migx", "sources":"", "inputOptionValues":"", "default":"", "useDefaultIfEmpty":"0", "pos":1 }, { "MIGX_id":2, "field":"visible_in_slider", "caption":"\u0412\u0438\u0434\u0435\u043d \u0432 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0435", "description":"", "description_is_code":"0", "inputTV":"", "inputTVtype":"checkbox", "validation":"", "configs":"", "restrictive_condition":"", "display":"", "sourceFrom":"migx", "sources":"", "inputOptionValues":"1==1", "default":"0", "useDefaultIfEmpty":1, "pos":2 }, { "MIGX_id":3, "field":"visible_on_page", "caption":"\u0412\u0438\u0434\u0435\u043d \u0432 \u043e\u043a\u043d\u0435", "description":"", "description_is_code":"0", "inputTV":"", "inputTVtype":"checkbox", "validation":"", "configs":"", "restrictive_condition":"", "display":"", "sourceFrom":"migx", "sources":"", "inputOptionValues":"1==1", "default":1, "useDefaultIfEmpty":1, "pos":3 } ], "pos":1 } ], "contextmenus":"edit_migx||remove_migx_and_image", "actionbuttons":"loadfromsource||uploadfiles", "columnbuttons":"remove_migx_and_image", "filters":"", "extended":{ "migx_add":"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0444\u043e\u0442\u043e", "disable_add_item":1, "add_items_directly":1, "formcaption":"\u0424\u043e\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f", "update_win_title":"", "win_id":"migx_photo_uploads_ext_win_id", "maxRecords":"", "addNewItemAt":"bottom", "media_source_id":"", "multiple_formtabs":"", "multiple_formtabs_label":"", "multiple_formtabs_field":"", "multiple_formtabs_optionstext":"", "multiple_formtabs_optionsvalue":"", "actionbuttonsperrow":4, "winbuttonslist":"", "extrahandlers":"this.uploadImages||this.handleColumnSwitch", "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":"" }, "permissions":{ "apiaccess":"", "view":"", "list":"", "save":"", "create":"", "remove":"", "delete":"", "publish":"", "unpublish":"", "viewdeleted":"", "viewunpublished":"" }, "fieldpermissions":"", "columns":[ { "MIGX_id":1, "header":"\u0424\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f", "dataIndex":"image", "width":50, "sortable":"false", "show_in_grid":1, "customrenderer":"", "renderer":"this.renderImage", "clickaction":"", "selectorconfig":"", "renderchunktpl":"", "renderoptions":"", "editor":"" }, { "MIGX_id":2, "header":"\u041d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 (1, 2, 3, 5 \u0448\u0442.)", "dataIndex":"visible_in_slider", "width":5, "sortable":true, "show_in_grid":1, "customrenderer":"", "renderer":"this.renderSwitchStatusOptions", "clickaction":"switchOption", "selectorconfig":"", "renderchunktpl":"", "renderoptions":[ { "MIGX_id":3, "name":"0", "use_as_fallback":1, "value":"0", "clickaction":"switchOption", "handler":"", "image":"assets\/img\/icons\/no.png" }, { "MIGX_id":1, "name":1, "use_as_fallback":"", "value":1, "clickaction":"switchOption", "handler":"", "image":"assets\/img\/icons\/yes.png" }, { "MIGX_id":4, "name":"0", "use_as_fallback":"", "value":"0", "clickaction":"switchOption", "handler":"", "image":"assets\/img\/icons\/no.png" } ], "editor":"" }, { "MIGX_id":3, "header":"\u0412 \u043e\u043a\u043d\u0435", "dataIndex":"visible_on_page", "width":10, "sortable":true, "show_in_grid":1, "customrenderer":"", "renderer":"this.renderSwitchStatusOptions", "clickaction":"switchOption", "selectorconfig":"", "renderchunktpl":"", "renderoptions":[ { "MIGX_id":3, "name":1, "use_as_fallback":1, "value":1, "clickaction":"switchOption", "handler":"", "image":"assets\/img\/icons\/yes.png" }, { "MIGX_id":4, "name":"0", "use_as_fallback":"", "value":"0", "clickaction":"switchOption", "handler":"", "image":"assets\/img\/icons\/no.png" }, { "MIGX_id":1, "name":1, "use_as_fallback":"", "value":1, "clickaction":"switchOption", "handler":"", "image":"assets\/img\/icons\/yes.png" } ], "editor":"" } ], "category":"" }

@DmitryFX DmitryFX changed the title getImageList where filter not working with "use_as_fallback" values getImageList where filter not working with default field values Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant