Open imonteiro opened 11 years ago
From bento.vi...@gmail.com on December 15, 2010 23:18:08 Hi,
Can you please check if this still happens?
Best Regards, Bento Vilas Boas
From rbejen...@gmail.com on December 18, 2010 22:33:00 Hi. Yes , the bug is still there.
Just test it with this simple code:
$db = Zend_Db_Table_Abstract::getDefaultAdapter(); $grid_config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/admin/grid.ini', 'production'); $grid = Bvb_Grid::factory('table', $grid_config, $id = ''); $grid->setRowAltClasses("odd", "even"); $grid->setRecordsPerPage(20); $grid->setNoFilters(0); $select = $db->select(); $select->from('articles', array( "*" ));
$grid->setSource(new Bvb_Grid_Source_Zend_Select($select));
$grid->setColumnsHidden($grid->getFields());
$grid->updateColumn('article_title',
array(
'style' => 'width:45%',
'title' => 'Title',
'orderField'=> 'article_id'
'position' => 1,
'hidden' => 0
));
$this->view->grid = $grid->deploy();
I just checked with the latest code from svn, and the orderField is not working, the column is still ordering after article_title from the case above, not article_id..
From bento.vi...@gmail.com on January 26, 2011 05:27:42 Hi,
Finally I got it.
Please update your code to latest revision
Best Regards, Bento Vilas Boas
From rbejen...@gmail.com on February 22, 2011 16:06:10 It is still happening , but only to the column with position 1.
From rbejen...@gmail.com on February 22, 2011 16:18:48 There is a problem i noticed it now. When you setup order=false to the column from first position, at the second column you have the orderField for first Column. I think it is still an issue here, the orderField from first column is not read, and if i setup the order to false, then it is read to second column...
$db = Zend_Db_Table_Abstract::getDefaultAdapter(); $grid_config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/admin/grid.ini', 'production'); $grid = Bvb_Grid::factory('table', $grid_config, $id = ''); $grid->setRowAltClasses("odd", "even"); $grid->setRecordsPerPage(20); $grid->setNoFilters(0); $select = $db->select(); $select->from('articles', array( "*" ));
$grid->setSource(new Bvb_Grid_Source_Zend_Select($select));
$grid->setColumnsHidden($grid->getFields());
$grid->updateColumn('article_title',
array(
'style' => 'width:45%',
'title' => 'Title',
'order'=>false,
'orderField'=> 'article_id'
'position' => 1,
'hidden' => 0
));
$grid->updateColumn('article_content',
array(
'style' => 'width:45%',
'title' => 'Title',
'orderField'=> 'article_date'
'position' => 2,
'hidden' => 0
));
$this->view->grid = $grid->deploy();
Original author: rbejen...@gmail.com (August 12, 2010 20:38:01)
$select = $db->select (); $select->from ( 'oferts'); $select->joinLeft ( 'images', 'oferts.oferts_id=images.img_ofert_id' ); $grid->setSource ( new Bvb_Grid_Source_Zend_Select ( $select ) ); $grid->setColumnsHidden ( $grid->getFields () );
$grid->updateColumn ( 'img_name', array (
'title' => 'ID', 'orderField' => 'ofert_id', 'hidden' => 0, ) );
Hi. I think there is an issue with orderField feature for columns. If I set it like it is in the code aboive, it will not work. $select = $db->select (); $select->from ( 'oferts'); $select->joinLeft ( 'images', 'oferts.oferts_id=images.img_ofert_id' ); $grid->setSource ( new Bvb_Grid_Source_Zend_Select ( $select ) ); $grid->setColumnsHidden ( $grid->getFields () );
$grid->updateColumn ( 'img_name', array (
'title' => 'ID', 'orderField' => 'ofert_id', 'hidden' => 0, ) );
I didn't debug a lot , but i noticed that in file Grid.php, function _buildTitles () , if i dump
Zend_Registry::get('log')->info($this->_fields); Zend_Registry::get('log')->info($this->_resetKeys($this->_data['fields']));
, the first value from $this->_fields is img_name, when the first value of $this->_resetKeys($this->_data['fields']) is oferts_id .
To notice the problem, just dump the return value of the _buildTitles function, and you will see the orderField is not setup for the column where i setup the orderField. Just make sure, when you select, select all the values from your test table, make the all hidden using $grid->setColumnsHidden ( $grid->getFields () ); , and after that setup orderField and hidden=0 for your column.
I hope I explained the problem well.
Thank you.
Original issue: http://code.google.com/p/zfdatagrid/issues/detail?id=414