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

Incorrect file source for images in MIGX-grid inside another MIGX-grid #434

Open
Ruslan-Aleev opened this issue Jul 17, 2024 · 4 comments
Open

Comments

@Ruslan-Aleev
Copy link
Contributor

  1. I create a TV for the image (standard TV image in MODX), set the file source for the TV, and specify the TV in the MIGX Form Tabs via the inputTV for the MIGX-TV grid.

migx_source_1

  1. Then I set this MIGX-TV through inputTV in another MIGX-TV grid.

migx_source_2

  1. So, image previews ("renderer": "this.renderImage") when adding/editing an element are not displayed correctly.
    This happens because the file source is set to standard (from the system settings), and not the TV source (this can be seen by viewing the element code).

migx_source_3

Probably some of the functions are not working correctly.

https://github.com/Bruno17/MIGX/blob/master/core/components/migx/model/migx/migx.class.php#L1695

https://github.com/Bruno17/MIGX/blob/master/core/components/migx/model/migx/migx.class.php#L1707

@Bruno17
Copy link
Owner

Bruno17 commented Jul 18, 2024

did you try to debug, what happens in getFieldSource?

@Ruslan-Aleev
Copy link
Contributor Author

I tried debug, but I didn't quite understand the logic. getFieldSource returns $mediasource = $this->getDefaultSource() it seems.
Maybe the problem in prepareSourceForGrid($inputTv) in the line $tv = $this->modx->newObject('modTemplateVar') I tried watching ID TV and sources and the last TV didn't have ID.

@halftrainedharry
Copy link
Contributor

Is there a reason why you use an image TV "slider_src" and not just "inputTVtype":"image"?


Maybe try using the setting "sourceFrom".
It kind of seems to work if I use "sourceFrom": "migx" in "about_slider_items" and "sourceFrom": "tv" in "about_slider" and set the correct media-source in the TV "about_slider_items".

about_slider_items

[{
	"caption": "Слайдер",
	"fields": [{
		"field": "image",
		"caption": "Изображение",
		"inputTV": "slider_src",
		"sourceFrom": "migx"
	}]
}]

about_slider

{
	"field": "items",
	"caption": "Изображения",
	"inputTV": "about_slider_items",
	"sourceFrom": "tv"
}

Also, have you tried using MIGX configurations (menu "Extras" ("Пакеты") -> "MIGX" ->tab "MIGX") instead of putting all the settings directly into TVs?

@Ruslan-Aleev
Copy link
Contributor Author

Is there a reason why you use an image TV "slider_src" and not just "inputTVtype":"image"?

I'm using inputTV to set the media source. There is probably another option, but this one is more familiar to me, and it works reliably.

Maybe try using the setting "sourceFrom".

Yes, this works, thanks.
I solved this using renderChunk, where I set the id media source:

[{
"dataIndex": "image",
"header": "Изображение",
"sortable": "false",
"renderer": "this.renderChunk",
"renderchunktpl": "<img src='/promtConnectors/system/phpthumb.php?h=80&f=png&src=[[+image]]&source=4'>",
"width": "900"
}]

Also, have you tried using MIGX configurations (menu "Extras" ("Пакеты") -> "MIGX" ->tab "MIGX") instead of putting all the settings directly into TVs?

For this task it is unnecessary, as it seems to me, MIGX configuration takes a lot of time.

I understand that the problem can be solved in different ways, BUT the fact that the current option works a little incorrectly is 100%.

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

3 participants