you can create your own getcombo - processors under
core/components/yourpackage/processors/mgr/default/getpublishedcombo.php
with something like that:
<?php
$config = $modx->migx->customconfigs;
$emtpytext = $config['gridfilters'][$scriptProperties['searchname']]['emptytext'];
$emtpytext = empty($emtpytext) ? 'all' : $emtpytext;
$options = array();
$options[] = array('combo_name' => $emtpytext, 'combo_id' => 'all');
$options[] = array('combo_name' => 'published', 'combo_id' => '1');
$options[] = array('combo_name' => 'unpublished', 'combo_id' => '0');
$count = count($options);
return $this->outputArray($options, $count);
and set it up like:
{
"MIGX_id":2,
"name":"published",
"label":"Published",
"emptytext":"Filter by Published",
"type":"combobox",
"getlistwhere":{
"published":"[[+published]]"
},
"getcomboprocessor":"getpublishedcombo",
"combotextfield":"",
"comboidfield":"",
"comboparent":"",
"default":""
}
to get values of another table try something like that:
core/components/yourpackage/processors/mgr/default/getcategoriescombo.php
<?php
//if (!$modx->hasPermission('quip.thread_list')) return $modx->error->failure($modx->lexicon('access_denied'));
$config = $modx->migx->customconfigs;
$textfield = $config['gridfilters'][$scriptProperties['searchname']]['combotextfield'];
$idfield = $config['gridfilters'][$scriptProperties['searchname']]['comboidfield'];
$idfield = empty($idfield) ? $textfield : $idfield;
$prefix = isset($config['prefix']) && !empty($config['prefix']) ? $config['prefix'] : null;
if (isset($config['use_custom_prefix']) && !empty($config['use_custom_prefix'])) {
$prefix = isset($config['prefix']) ? $config['prefix'] : '';
}
if (!empty($config['packageName'])) {
$packageNames = explode(',', $config['packageName']);
if (count($packageNames) == '1') {
//for now connecting also to foreign databases, only with one package by default possible
$xpdo = $modx->migx->getXpdoInstanceAndAddPackage($config);
} else {
//all packages must have the same prefix for now!
foreach ($packageNames as $packageName) {
$packagepath = $modx->getOption('core_path') . 'components/' . $packageName . '/';
$modelpath = $packagepath . 'model/';
if (is_dir($modelpath)) {
$modx->addPackage($packageName, $modelpath, $prefix);
}
}
$xpdo = &$modx;
}
} else {
$xpdo = &$modx;
}
$classname = 'modCategory';
$sort = $modx->getOption('sort', $scriptProperties, $textfield);
$dir = $modx->getOption('dir', $scriptProperties, 'ASC');
$c = $xpdo->newQuery($classname);
//$count = $modx->getCount($classname,$c);
$c->select($classname . '.id, ' . $idfield . ' as combo_id, ' . $textfield . ' as combo_name');
$c->sortby($sort, $dir);
$stmt = $c->prepare();
//echo $c->toSql();
$stmt->execute();
$rows = $stmt->fetchAll();
$count = count($rows);
$emtpytext = $config['gridfilters'][$scriptProperties['searchname']]['emptytext'];
$emtpytext = empty($emtpytext) ? 'all' : $emtpytext;
$rows = array_merge(array(array('combo_id' => 'all', 'combo_name' => $emtpytext)), $rows);
return $this->outputArray($rows, $count);
and set it up like
{
"MIGX_id":2,
"name":"category",
"label":"category",
"emptytext":"Select Category",
"type":"combobox",
"getlistwhere":{
"category":"[[+category]]"
},
"getcomboprocessor":"getcategoriescombo",
"combotextfield":"category",
"comboidfield":"id",
"comboparent":"",
"default":""
}