you have a chance to manipulate the migx-items with a processor.
Normally there isn't called a processor, when clicking done.
But if you have one of the columns with the renderChunk - renderer, MIGX does call a processor, each time you change anything.
This seems to work, just tested it.
Do the configuration for your MIGX-TV with the MIGX-configurator-CMP.
You have many options there.
Create a MIGX-configuration.
Add your formtabs and columns.
Add one additional unused column and use the renderChunk-renderer fot that column.(this is for calling the processor).
Put in the field 'package name' for example 'mycustomcomponent' under the tab migxdb-settings
Create a file with this path: core/components/mycustomcomponent/processors/mgr/default/collectmigxitems.php
with code something like that:
<?php
$items = $modx->getOption('items', $scriptProperties, '');
if (!empty($items)) {
$items = $modx->fromJson($items);
$firstrow = $items[0];
$names = explode(',', $firstrow['name1']);
$max_migxid = 0;
foreach ($items as $item) {
if ($item['MIGX_id'] > $max_migxid) {
$max_migxid = $item['MIGX_id'];
}
}
$migx_id = $max_migxid + 1;
if (count($names) > 1) {
$items[0]['name1'] = $names[0];
foreach ($names as $key => $name) {
if ($key == 0) {
continue;
}
$item = array();
$item['name1'] = $name;
$item['MIGX_id'] = $migx_id;
$migx_id++;
$items[] = $item;
}
}
$rows = $modx->migx->checkRenderOptions($items);
//print_r($items);
//$items = $modx->toJson($items);
}
return $modx->error->success('', $rows);
[ed. note: Bruno17 last edited this post 12 years, 3 months ago.]