tingobol / gii-template-collection

Automatically exported from code.google.com/p/gii-template-collection
0 stars 0 forks source link

GtC unselects all selected option when using the Relation widget to add a new related option. #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There are only two things that need to be done to fix this.

1. On line 676 of components/Relation.php the 'id' queryparam needs to be added 
to the 'addButtonRefreshUrl' code turning it into this:

$this->addButtonRefreshUrl = $this->controller->createUrl($model . 
'/getOptions', array(
    'relation'  => $this->relation,
    'style'     => $this->style,
    'fields'    => $this->fields,
    'id'        => $this->_model->id
    )
);

Then in GController.php on line 20 the current call to:

    $model = new $classname;

Needs to be this:

    $model = $this->loadModel();

Once those modifications have been made, when a user adds a new option to a 
form the old options will not be deselected.

Original issue reported on code.google.com by s...@moedesigns.com on 25 Oct 2010 at 10:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
in GController we should check for the existence of $_GET['id']

ie:

$model = (isset($_GET['id']) && is_numeric($_GET['id'])) ? $this->loadModel() : 
new $classname;

Original comment by s...@moedesigns.com on 26 Oct 2010 at 7:18