Let's say I created a model "product" with a few fields such as "name", "price","tax","shipping" etc.
At first I just want to show name and price in the grid:
$g = $this->add('MVCGrid')
$g -> setModel('product', array('name','price'));
Then I would like to add a column of expander button called "sold" to update the "tax" and "shipping" for that product:
$g -> addColumn('expander','sold');
In the sold.php file, I put:
$f = $this -> add('MVCForm');
$f -> setModel('product',array('tax','shipping'));
$f -> addSubmit()-> setLabel('Update');
My question is how to get the id of the product I am trying to update in the expander page? i.e. what kind of code should I put in the
if($f->isSubmitted()){
}
in order to update the tax and shipping of the product which I clicked the "sold" expander button on?
BTW: is there any way that I can close the expander after I hit the submit button?
Expander passes the id through several GET variables:
Using 'id' is handy, but the second method is handier if you are doing nesting expanders. Don't forget to use stickyGET().