subgrid blank add form?



Due to phpGrid internal function call sequence, the enable_edit() should always be called BEFORE set_subgrid() method, or edit properties will be ignored, or you will see a blank add record form similar to above.


CORRECT:
$sg = new C_DataGrid("SELECT * FROM suppliers","supplierCode","suppliers");
$sg->enable_edit('INLINE', 'CRUD');

//supplier detail2: products
$sg_d2 = new C_DataGrid("SELECT * FROM products","productCode","products");
$sg_d2->enable_edit('INLINE', 'CRUD');

//set detail 2 for suppliers
$sg->set_subgrid($sg_d2, 'supplierZip');
$sg->display();

WRONG!!!:
$sg = new C_DataGrid("SELECT * FROM suppliers","supplierCode","suppliers");

//supplier detail2: products
$sg_d2 = new C_DataGrid("SELECT * FROM products","productCode","products");

//set detail 2 for suppliers
$sg->set_subgrid($sg_d2, 'supplierZip');
$sg->enable_edit('INLINE', 'CRUD');
$sg_d2->enable_edit('INLINE', 'CRUD');
$sg->display();

Feedback and Knowledge Base