AshishJoshi-asj / zfdatagrid

Automatically exported from code.google.com/p/zfdatagrid
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

double_tables option have no effect #167

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. $form->setDouble_tables(1);
2.
3.

What is the expected output? What do you see instead?
Form and Grid at the same page
Just Grid

What version of the product are you using? On what operating system?
0.6alpha

Please provide any additional information below.

Original issue reported on code.google.com by vlatko.b...@gmail.com on 15 Feb 2010 at 8:57

GoogleCodeExporter commented 9 years ago
Hi,

Please update to the latest Revision 607

Also its not:
$form->setDouble_tables(1);
use instead
$form->setDoubleTables(1);

Sorry about that...

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 15 Feb 2010 at 5:40

GoogleCodeExporter commented 9 years ago
Hi,

I tried this

 $form1->setDoubleTables(1);
 $this->view->table1 = $grid1->deploy();

I have this settings

options Array [7]   
    add (boolean) true  
    edit    (boolean) true  
    button  (boolean) true  
    delete  (boolean) true  
    addForce    Array [1]   
    editForce   Array [1]   
    doubleTables    (int) 1 

I'm now on rev608

Original comment by vlatko.b...@gmail.com on 15 Feb 2010 at 6:37

GoogleCodeExporter commented 9 years ago
Hi,

No changes?

Have you added the form to the grid?

$grid1->addForm($form1);

Check out the example: http://zfdatagrid.com/grid/default/site/double

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 16 Feb 2010 at 2:06

GoogleCodeExporter commented 9 years ago
Hi,

I checked in example application the multi action. 
I commented the second table and for the first

function multiAction () {
  $grid = $this->grid('2');
//$select = $this->_db->select()->from('City');
//$grid->query($select);

$grid->setModel(new Addressbook());

  $form = new Bvb_Grid_Form();
  $form->setAdd(1)->setEdit(1)->setDelete(1)->setButton(1);
//$form->setModel(new Addressbook());
  $grid->addForm($form);
  $grid->setDoubleTables(1);
/*
second table ...
*/

  $this->view->pages = $grid->deploy();
//$this->view->pages1 = $grid1->deploy();

  $this->render('index');

It doesn't work. Grid displayed, Form displays in second page when I click Edit.

Original comment by vlatko.b...@gmail.com on 16 Feb 2010 at 6:50

GoogleCodeExporter commented 9 years ago
It works, found the problem.

I was setting doubleTables after the Form was added to Grid.

What do you think about extracting code from Table.php (lines 1615 to 1661) 
into a
separate  function, so it can maybe be called before deploy() also?

I did the change and Table.php is attached. Changed two parts are marked with
//******************************** new

I tried it (with one and two Grids and with one and two Forms) and it seems to 
work
with no problems.

I'm having Grid and Form creation in model class, so later changes are more
difficult. This seems to me as a nice and clean solution.

What do you think? Is this a harmless operation?

Original comment by vlatko.b...@gmail.com on 16 Feb 2010 at 12:50

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

The code on comment 4 works fine for me.

You can use $form->setDoubleTables(1) and then
$grid->addForm($form);

Or, you can add the option directly into the grid

$grid->setDoubleTables(1); //after addForm(); 

One aside note, the method $form->setButton(); has been renamed to
$form->setAddButton(true|false);

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 16 Feb 2010 at 2:59

GoogleCodeExporter commented 9 years ago
Verified

Original comment by vlatko.b...@gmail.com on 16 Feb 2010 at 3:45

GoogleCodeExporter commented 9 years ago

Original comment by bento.vi...@gmail.com on 3 Mar 2010 at 4:56