Release: Version 0.5

Hi guys,

I’m pleased to announce the availability of Zf Datagrid 0.5 for download

This version has some big changes.

  • You must use Zend_Db_Select to perform queries based grids
  • Most of the issues reported are fixed
  • Ajax Support
  • Multi grids per page
  • Callback support for CRUD operations
  • Callback support for presentation
  • Improved SQL EXPS
  • Code cleanup
  • A lot of small improvements…

You can download this version here http://www.zfdatagrid.com/category/downloads/
Regards,

10 Comments »

  1. binio Said,

    January 12, 2010 @ 00:16

    Hey Bento,
    I have some problems with logging, it isnt log in me but pass and login are correct.

    By the way I have strange problem with new grid.
    I create subqueries with Zend_db_expr:

    $db = Zend_Registry::get ( ‘database’ );
    $subSelect = $db->select();
    $subSelect->from(array(‘r’ => ‘realisations’), array(‘COUNT(r.id)’));
    $subSelect->where(‘r.company_id = c.id’);
    $colExpr = new Zend_Db_Expr(‘(‘.$subSelect -> __toString() .’) AS projects’);
    $grid = $this->grid (‘table’);
    $grid->query ( $db->select()->from(array(‘c’ => ‘companies’), array(‘c.id’, ‘c.company’, ‘c.address’, ‘c.nip’, $colExpr)));

    IF I drop it to string recieve:
    SELECT `c`.`id`, `c`.`company`, `c`.`address`, `c`.`nip`, (SELECT COUNT(r.id) FROM `realisations` AS `r` WHERE (r.company_id = c.id)) AS projects FROM `companies` AS `c`

    It is exactyly what I need, but in grid I can’t see column ‘projects’, another column (nip) I see twice.

    Columns are defined properly.

    Could you help me ?
    Binio

  2. binio Said,

    January 12, 2010 @ 00:17

    Problems with logging in FF, not IE

  3. Bento Vilas Boas Said,

    January 13, 2010 @ 19:05

    Hi Binio,

    Please set up fields alias using key=>value.

    Something like this will solve your problem.

    [CODE]
    $db = Zend_Registry::get ( ‘database’ );
    $subSelect = $db->select ();
    $subSelect->from ( array (‘r’ => ‘realisations’ ), array (‘COUNT(r.id)’ ) );
    $subSelect->where ( ‘r.company_id = c.id’ );
    $colExpr = new Zend_Db_Expr ( ‘(‘ . $subSelect->__toString () . ‘)’ );
    $grid = $this->grid ( ‘table’ );
    $grid->query ( $db->select ()->from ( array (‘c’ => ‘companies’ ), array (‘c.id’, ‘c.company’, ‘c.address’, ‘c.nip’, ‘projects’=>$colExpr ) ) );

    [/CODE]

    Best Regards,
    Bento Vilas Boas

  4. Italba Said,

    January 15, 2010 @ 16:03

    Could you please provide an example on how to translate datagrid’s messages (for instance “Remove Order”) in another language?

    Thank you,

    Italo A.

  5. Italba Said,

    January 15, 2010 @ 17:09

    I find the answer by myself again! Sorry, could not belive it was so easy.
    In Bootstrap.php:

    [CODE]

    protected function _initLocale()
    {
    $localeValue = ‘it’;

    $locale = new Zend_Locale($localeValue);
    Zend_Registry::set(‘Zend_Locale’, $locale);

    $translationFile = realpath(APPLICATION_PATH .
    DIRECTORY_SEPARATOR . ‘..’ .
    DIRECTORY_SEPARATOR . ‘lang’ .
    DIRECTORY_SEPARATOR . $localeValue . ‘.inc.php’);

    $translate = new Zend_Translate(‘array’, $translationFile, $localeValue);
    Zend_Registry::set(‘Zend_Translate’, $translate);
    }

    [/CODE]

    The translation file /lang/it.inc.php:

    [CODE]
    ‘Togli ordinamento’,
    ‘Remove Filters’ => ‘Togli filtri’,
    ‘Next’ => ‘Seguenti’,
    ‘Last’ => ‘Ultimi’,
    ‘Previous’ => ‘Precedenti’,
    ‘First’ => ‘Primi’,
    ‘to’ => ‘-’,
    ‘of’ => ‘di’,
    ‘records’ => ‘righe’);

    [/CODE]

    And it works!
    Just some minor issues:
    1) Does not translate ‘records’.
    2) “First Previous 12345 Next Last”, in italian, is split in two lines.
    3) When showing the last page with only one record, it says “60 to 61 of 61 records”.

    Thank you again,

    Italo A.

  6. binio Said,

    January 23, 2010 @ 11:35

    Hi Bento,

    Based on my earlier example, I tried to use sqlexp:
    $grid->sqlexp(array(‘projects’ => array(‘functions’ => array(‘SUM’), ‘value’ => ‘projects’)));

    It doesnt work, in my opinion problem appears when I use joins.

    Maybe I do somthing wrong …?

  7. binio Said,

    January 23, 2010 @ 14:11

    I found a bug,

    Line 2119, Bvb_Grid_DataGrid

    was: $finalResult = $result1 [0]->TOTAL;
    I changed into
    $finalResult = 0;
    foreach ($result1 as $resJ):
    $finalResult += $resJ->TOTAL;
    endforeach;

  8. Bento Vilas Boas Said,

    January 24, 2010 @ 00:25

    Hi Binio,

    There is a problem in version 0.5 that affects the way fields are treated. In version 0.6 this problem doesn’t exist.

    Meanwhile you can correct this by using the following code:

    [CODE]
    $grid->sqlexp = array(‘c.projects’ => array(‘functions’ => array(‘SUM’), ‘value’ => “(“.$subSelect->__toString () .”)”));
    [/CODE]

    Thanks,

    Best Regards,
    Bento Vilas Boas

  9. Italba Said,

    January 26, 2010 @ 14:19

    Hi, I got a warning (/Bvb/Grid/Deploy/Table.php on line 1499, undefined offset:1) for each displayed record. My table have two fields only, I hide the first field (key), added a column to the left with a link to “edit”. Beside the warnings, everything works fine.

  10. Bento Vilas Boas Said,

    January 27, 2010 @ 02:40

    Hi Italba,

    Thanks for the report.

    If you want this issues fixed before next release please open the /Bvb/Grid/Deploy/Table.php file and go to the line 1499:

    Should be like this:
    [CODE]
    if ($search [1] == ‘E’) {
    [/CODE]

    Replace it with
    [CODE]
    if (isset($search [1]) && $search [1] == ‘E’) {
    [/CODE]

    thanks again,

    Best Regards,
    Bento Vilas Boas

RSS feed for comments on this post

Leave a Comment

You must be logged in to post a comment.