Release: 0.6.5

Hi everyone.

Great news. Version 0.6.5 has just been released. As you may already know, it has 4 new “major” features:

Also, it includes small improvements:

  • Display filters in export pdf’s
  • Bugs fixes dealing with config files
  • Incorrect links when using ajax and Zend_layout
  • Fields Values can now be translated
  • Order Distinct Values in Filters
  • SQL EXPR are now applied to every group on horizontal rows
  • When adding records a new button may be added. Save && add new. To return to the same page
  • Method for retrieving form error messages (Since forms use PRG)
  • “Basic” route support
  • Ajax loading image
  • Support for columns that were not in the query. ($grid->getSelect()->columns(array(…..)))
  • Labels in forms have now the same title they have in  grid
  • Improvements with table template
  • coding standards improvements
  • and more than 30 bug fixes

Changes:

  • setPagination is now setNumberRecordsPerPage();
  • Interfaces and abstract classes are now prefixed with the class name. Bvb_Grid_Filters_Render_Abstract => Bvb_Grid_Filters_Render_Render_Abstract

Also, I’m building a new section for code snippets, CSS tables galleries and screencasts to help users getting started. And most importantly, already started to build unit tests (ya, I know…). Meaning this that the next release will be about code and not new features.

You can download this version trough google code, http://code.google.com/p/zfdatagrid/downloads/list . Wiki has also been updated.

Please report any bug you find, and let me know what you think about this grid.

Best Regards,
Bento Vilas Boas

26 Comments »

  1. J. Khen Said,

    June 9, 2010 @ 14:51

    Hi Bento ! Great works !! Thanks for 0.6.5 version !!!

    I need help… I have a table “users” with field “password”. How to create a password type input field on grid and save this with MD5 function ??

    I think use “setCallbackBeforeInsert / Update” (for MD5), have you a example ?

    Thanks !

    B. R.

    J. Khen

  2. Bento Vilas Boas Said,

    June 9, 2010 @ 15:16

    Hi Khen,

    Sure I can.

    Check this link for code

    http://pastie.org/997817

    Best Regards,
    Bento Vilas Boas

  3. sqrbrkt Said,

    June 9, 2010 @ 16:19

    Awesome news Bento! I look forward to checking it out

  4. J. Khen Said,

    June 9, 2010 @ 20:57

    Hi Bento !

    Thanks for fast reply !

    I testing and get “my_callback not callable” error :-/

    The code: http://pastebin.com/NRMmQ7ac

    “Components_Gridmaster” is a single class for ZFDatagrid configs.

    Thanks for your help !

    J. Khen

  5. Bento Vilas Boas Said,

    June 10, 2010 @ 02:22

    Hi,

    That means PHP can’t reach the provided function. If you are using a class method use

    my_callback must be an existing function…

    $form->setCallbackBeforeInsert(array($this,’my_callback’));

    Best Regards,
    Bento Vilas Boas

  6. dermisek Said,

    June 10, 2010 @ 05:27

    Hi,

    I have a query or maybe a new feature idea: Are you thinking of implementing support for zend_db_select with unions?

    Currently the class Bvb_Grid_Source_Zend_Select works fine with regular queries, but cannot parse out the Select objects with unions (http://framework.zend.com/manual/en/zend.db.select.html -> see ‘Building a UNION Query’)

    Thanks.

    Tomas

  7. J. Khen Said,

    June 10, 2010 @ 14:47

    Hi Bento !

    Thank you for the explanation !!

    Working ok now !!

    Great !!

    B.R.

    J. Khen

  8. Bento Vilas Boas Said,

    June 10, 2010 @ 14:49

    Hi,

    I will take a look on that. Will get back to you in a few hours.

    Best Regards,
    Bento Vilas Boas

  9. Bento Vilas Boas Said,

    June 10, 2010 @ 22:19

    Hi,

    I don’t know if this is my mistake, but the online example provided does not work.

    Is seams that Zend_Db makes a raw query like this:


    SELECT `Country`.`Continent`, `Country`.`Code` FROM `Country` LIMIT 12 UNION SELECT `City`.`Name`, `City`.`District` FROM `City` LIMIT 12

    instead of


    (SELECT `Country`.`Continent`, `Country`.`Code` FROM `Country` LIMIT 12 ) UNION (SELECT `City`.`Name`, `City`.`District` FROM `City` LIMIT 12)

    And without the () we can not sort the results…

    maybe I’m not figuring this thing out…

    Can you use this feature without problems, with conditions and sort?

    Best Regards,
    Bento Vilas Boas

  10. dermisek Said,

    June 15, 2010 @ 05:18

    Hi Bento,

    the problem I had was missing fields (columns) the select object, because the union select one does not contain any columns, but only 2 other separate select objects therefore I get various php errors/warnings and exceptions. few examples:

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home//www/zend_studio/mycompany_3_2/library/Bvb/Grid.php on line 720

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/www/zend_studio/mycompany_3_2/library/Bvb/Grid.php on line 2168

    Warning: Invalid argument supplied for foreach() in /home/www/zend_studio/mycompany_3_2/library/Bvb/Grid.php on line 2204

    Catchable fatal error: Argument 1 passed to Bvb_Grid::_validateFields() must be an array, null given, called in /home/www/zend_studio/mycompany_3_2/library/Bvb/Grid.php on line 1953 and defined in /home/tomas.dermisek/www/zend_studio/mycompany_3_2/library/Bvb/Grid.php on line 1742

    All these errors pop up once I replace the query with any select with union.

    If you need more information on this – pls send me email dermisek at gmail . com

    Thanks.

    tomas

  11. kim Said,

    June 29, 2010 @ 22:20

    Hi,

    thanx for the new release it’s a great step forward.

    But i wonder why i can’t get the add record button to display in CRUD grids.

    I have the following code:

    ————
    $sessConf = new Zend_Session_Namespace(‘confId’);
    $confId = $sessConf->confId;
    $db = Zend_Registry::get(“db”);

    $grid = Bvb_Grid::factory(‘table’, array());
    $grid->setImagesUrl(‘/druid/images/’);

    $select = $db->select()->from(‘conf_reg_level’);
    $select->where(‘conference_id=?’, $confId);

    $grid->setSource(new Bvb_Grid_Source_Zend_Select($select));
    $grid->setColumnsHidden(array(‘conference_id’));

    $form = new Bvb_Grid_Form($class=’Zend_Form’, $options =array());
    $form->setEdit(true)->setAdd(true)->setDelete(true);
    $form->setAdd(true);
    $grid->setForm($form);
    $form->setAddButton(true);
    $form->setAdd(true)->setEdit(true)->setDelete(true)->setAddButton(true)->setSaveAndAddButton(true);
    $this->view->grid = $grid->deploy()

    ———–

    i know there are many redundant callls to setAdd and some derivatives, but i an’t see the add record button.

    what else do i need? is it a style issue or something else?

    the grid shows as it should with edit and delete icons and the form shows correctly when editing.

    I look forward to your answer and thanks in advance.

    Kim

  12. Bento Vilas Boas Said,

    July 6, 2010 @ 17:48

    Hi Kim,

    You should see something like this: http://zfdatagrid.com/grid/default/site/crud

    Also strip your code to this:

    $sessConf = new Zend_Session_Namespace(‘confId’);
    $confId = $sessConf->confId;
    $db = Zend_Registry::get(“db”);

    $grid = Bvb_Grid::factory(‘table’, array());
    $grid->setImagesUrl(‘/druid/images/’);

    $select = $db->select()->from(‘conf_reg_level’);
    $select->where(‘conference_id=?’, $confId);

    $grid->setSource(new Bvb_Grid_Source_Zend_Select($select));
    $grid->setColumnsHidden(array(‘conference_id’));

    $form = new Bvb_Grid_Form();
    $form->setAdd(true)->setEdit(true)->setDelete(true)->setAddButton(true)->setSaveAndAddButton(true);

    $grid->setForm($form);
    $this->view->grid = $grid->deploy()

    If you are not using a custom template, you should at least see the “Add Record” text somewhere in your page.

    Best Regards,
    Bento Vilas Boas

  13. postnuke Said,

    July 18, 2010 @ 17:06

    Hi thanks great job.

    I see a problem, in Bvb/Grid.php line 1717 :
    Zend_Debug::dump($fields);

    this line must be:
    //Zend_Debug::dump($fields);

  14. altivec Said,

    September 3, 2010 @ 10:36

    Hi,

    Is there a way to make some of the results clickable ?
    I mean, by example, I’d like to open a PDF page when clicking on the ID result, so, I’d like to display a link, and pass the {{id}} parameter…

    Thanks for any help,

    I really enjoy this class !

  15. Bento Vilas Boas Said,

    September 3, 2010 @ 12:40

    @altivec

    Please take a look at decorators..

    http://code.google.com/p/zfdatagrid/wiki/Decorators

    $grid->updateColumn('id',array('decorator'=>'Click Here'));

    Com os melhores cumprimentos,
    Bento Vilas Boas

  16. altivec Said,

    September 7, 2010 @ 14:15

    @Bento Vilas Boas,

    Thank you so much !!! Works like a charm…

    Altivec.

  17. kim Said,

    December 3, 2010 @ 13:11

    Hi,

    when i try to insert a record from a form to the database i get a validation error.

    how do i get this error so i can display it to the user?

    kim

  18. Bento Vilas Boas Said,

    December 4, 2010 @ 16:47

    Hi Kim,

    Please use

    $grid->getFormErrorMessages()

    Best Regards,
    Bento Vilas Boas

  19. akaim Said,

    December 9, 2010 @ 17:21

    Hi,

    First, congratulations for your work. It’s awesome!

    Right now I’m trying use your plugin but I’m receiving this error
    «:
    Catchable fatal error: Argument 1 passed to Bvb_Grid::_validateFields() must be an array, null given, called in C:\wamp\www\trunk\library\Bvb\Grid.php on line 2202 and defined in C:\wamp\www\trunk\library\Bvb\Grid.php on line 1977
    »

    This is my ‘controller’ code:

    $consumers = new Model_DbTable_ConsumerList();
    $select = $consumers->selectList();

    $config = new Zend_Config_Ini(‘/configs/grid.ini’, ‘production’);
    $grid = Bvb_Grid::factory(‘Bvb_Grid_Deploy_Table’, $config, ‘id’);

    $grid->setSource(new Bvb_Grid_Source_Zend_Select($select));
    $this->view->grid = $grid->deploy();

    My model is just this:
    protected $_name = ‘consumerlist’;

    public function selectList($project_id) {
    $select = $this->select();
    return $select;
    }

    Can I use this as I presented?

    Thanks
    Ivo

  20. Bento Vilas Boas Said,

    December 9, 2010 @ 17:26

    hi Akim,

    Try this:

    $config = new Zend_Config_Ini(‘/configs/grid.ini’, ‘production’);
    $grid = Bvb_Grid::factory(‘Bvb_Grid_Deploy_Table’, $config, ‘id’);

    $grid->setSource(new Bvb_Grid_Source_Zend_Table(new Model_DbTable_ConsumerList()));
    $this->view->grid = $grid->deploy();

    Best Regards,
    Bento Vilas Boas

  21. akaim Said,

    December 9, 2010 @ 17:46

    Working, thanks.

    However, when I apply a filter the url it’s not changing correctly…

    «
    http://localhost/module1/consumers/index/p/13/_request_url/http://localhost/module1/consumers/index/p/13/fromid/G1//fromid/G1/
    »

    The ‘url rewrite’ isn’t working as expected. You know what is the possible reason? Some conflict with my code?
    I will try find out the issue.

    Thanks again.
    Ivo

  22. Bento Vilas Boas Said,

    December 9, 2010 @ 17:56

    Hi Ivo,

    Are you using routes?

    When you mouseover a link that is what you see?

    Best Regards,
    Bento Vilas Boas

  23. akaim Said,

    December 9, 2010 @ 18:05

    Yes, here is the code: http://pastebin.com/dfh4EMJV
    I also I created a helper to be easy create links: http://pastebin.com/DWJqWrFN

    When I pass the mouse over the link is the same.

    Thanks
    Ivo

  24. akaim Said,

    December 10, 2010 @ 17:15

    Hello again,

    It’s solved. Was a problem in my code, related with login controller. I was using the URL to send the user were originally trying to get in.

    Thanks again for all your answers.
    Ivo

  25. kim Said,

    December 13, 2010 @ 14:21

    hi,

    when i want to delete an entity i receive the following

    Notice: Undefined index: js in /var/www/druid/library/Bvb/Grid/Deploy/Table.php on line 2117 Notice: Undefined index: url in /var/www/druid/library/Bvb/Grid/Deploy/Table.php on line 2118

    on the delete confirmation page.
    why is that and how can i avoid it?

    br
    Kim

  26. Bento Vilas Boas Said,

    December 13, 2010 @ 17:59

    Kim,

    You can fix that upadating your code to the latest SVN revision, or adding this two lines at line 1890:

    if(!isset($this->_javaScriptHelper['js'])){$this->_javaScriptHelper['js']='';}
    if(!isset($this->_javaScriptHelper['url'])){$this->_javaScriptHelper['url']='';}

    Let me know.

    Best Regards,
    Bento Vilas Boas

RSS feed for comments on this post

Leave a Comment

You must be logged in to post a comment.