Hi, I working on a manager page with a grid on it. All works find but I have a question about the update from grid funcitonality.
I have made a grid like this
Page.grid.Frist = function(config) {
config = config || {};
Ext.applyIf(config, {
id: 'items-grid-first',
....
baseParams: { action: 'mgr/path/getlist' },
save_action: 'mgr/path/updateFromGrid',
....
All the stuff is working, but I have a ’category’ field in each grid-row, wich is a combobox with a database-driven category list. The id of the category is saved into the grid-record but I want to show the nice category-name. So in the getlist.php I have done a $item->getOne(’Category’); and put the ’name’ into the list, works fine!
By double clicking on the grid-row category-field the combobox appears correctly, and when I change the category, the save-action of the grid is working perfect. Only after the update the category id is shown instead of the new choosen category name. The updatefromgrid.php has this at last;
$item->fromArray($_DATA);
if($item->save() == false) {
return $modx->error->failure($modx->lexicon('item.error.save'));
}
/*
$category = $item->getOne('Category');
$item->category = ((!empty($category) && is_object($category)) ? $category->get('name') : $item->category);
*/
return $modx->error->success('', $item);
As you can see; i’ve tried to update the category value here for the view, but this doesn’t work.
Does anyone know what I mean and have any idea what I can try to get this realised? Thanks already!
Regards, Bert