Datagrid in Zend Framework

View: New views
7 Messages — Rating Filter:   Alert me  

Datagrid in Zend Framework

by Filipe Carvalho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    Hi all,

    I'm looking for something like phpGrid (http://www.phpgrid.com/). Not so advanced... i will be happy in having out the box features like:
    - Paging
    - Sorting columns
    - Capability to create links values of some columns

    It is not hard to do it, but using model-view-controller pattern I can't realize how to do something clean and reusable.

    Can you give some clues how to do it?

    Best Regards,

    Filipe Carvalho
  


smime.p7s (4K) Download Attachment

Re: Datagrid in Zend Framework

by Joó Ádám :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This looks neat – scaffolding and grid was already mentioned, would be
great to have a ZF component for this job. Is there any ongoing
development in this area?


Regards,
Ádám

Parent Message unknown RE: Datagrid in Zend Framework

by rcastley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

RE: [fw-general] Datagrid in Zend Framework

The way we have done it is to create a Javascript datagrid and we pass JSON strings from PHP.

The great thing about this is the client already has the JS cached so drawing grids is really snappy!

- Robert

-----Original Message-----
From: Joó Ádám [ceriak@...]
Sent: 07 May 2008 17:11
To: Filipe Carvalho
Cc: fw-general@...
Subject: Re: [fw-general] Datagrid in Zend Framework

This looks neat - scaffolding and grid was already mentioned, would be great to have a ZF component for this job. Is there any ongoing development in this area?


Regards,
Ádám

________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system.

________________________________________________________________________


________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________

RE: Datagrid in Zend Framework

by Eric Marden-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One of our developers created a helper that is model aware and outputs a table with those features. Its pretty flexible, and generic and are using it for many different models (i.e. its not tied to something, but instead ready to work with any of our model object). There is some talk about cleaning this up and releasing it for free, but its not quite ready for that yet.
 
 
--
Eric Marden
 


From: Filipe Carvalho [mailto:filipe.f.carvalho@...]
Sent: Wednesday, May 07, 2008 11:40 AM
To: fw-general@...
Subject: [fw-general] Datagrid in Zend Framework


    Hi all,

    I'm looking for something like phpGrid (http://www.phpgrid.com/). Not so advanced... i will be happy in having out the box features like:
    - Paging
    - Sorting columns
    - Capability to create links values of some columns

    It is not hard to do it, but using model-view-controller pattern I can't realize how to do something clean and reusable.

    Can you give some clues how to do it?

    Best Regards,

    Filipe Carvalho
  

RE: Datagrid in Zend Framework

by Kevin Hallmark :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Filpe,

 

I’m planning to split off the site specific code and release my TableMaker script this weekend.

 

I’ll be happy to let you know when that is done. I’ll try and draft together a little usage example explaining the different aspects of the helper.

 

I’ll make an announcement on this list for interested parties. Since this is my work e-mail, I won’t make the announcement on this list until Monday.

 

Kevin Hallmark
PHP Developer
Bonnier Corporation
460 N Orlando Ave Suite 200
Winter Park, FL 32789
(407) 571-4960
Kevin.hallmark@...


From: Eric Marden
Sent: Wednesday, May 07, 2008 3:52 PM
To: fw-general@...
Subject: RE: [fw-general] Datagrid in Zend Framework

 

One of our developers created a helper that is model aware and outputs a table with those features. Its pretty flexible, and generic and are using it for many different models (i.e. its not tied to something, but instead ready to work with any of our model object). There is some talk about cleaning this up and releasing it for free, but its not quite ready for that yet.

 

 

--

Eric Marden

 

 


From: Filipe Carvalho [mailto:filipe.f.carvalho@...]
Sent: Wednesday, May 07, 2008 11:40 AM
To: fw-general@...
Subject: [fw-general] Datagrid in Zend Framework


    Hi all,

    I'm looking for something like phpGrid (http://www.phpgrid.com/). Not so advanced... i will be happy in having out the box features like:
    - Paging
    - Sorting columns
    - Capability to create links values of some columns

    It is not hard to do it, but using model-view-controller pattern I can't realize how to do something clean and reusable.

    Can you give some clues how to do it?

    Best Regards,

    Filipe Carvalho
  


Re: Datagrid in Zend Framework

by Laurent Melmoux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Filipe,

I have done it base on 3 others component:

Mmx_Data_Sort
Mmx_Data_Criterion
Mmx_Data_Pager

There is no coupling between components so you can use them
individually. The rendering part is done as in Zend_Form : a
__toString() method is making use of view helpers.

May be http://xyster.devweblog.org/ and Xyster_Data is worth a like look
as component to build something upon. I haven’t time to get a closer
look though.

A basic use case:


// Data Grid
Zend_Loader::loadClass('Mmx_Data_Grid');
// Params: grid name, filter data, sort column
$grid = new Mmx_Data_Grid('users', $_POST, @$_GET['sort']);

$grid->addElement('integer', 'user_id');
$grid->addElement('integer', 'acl_role_id');
$grid->addElement('string', 'username');
$grid->addElement('string', 'firstname');
$grid->addElement('string', 'lastname');
$grid->addElement('boolean', 'isActive');

$grid->setDefaultSort('username');

$rowsPerPage = $this->getRequest()->getParam('limit');
$currentPage = $this->getRequest()->getParam('page', 1);
$totalRows = $usersTable->count($grid->getFilterCriteria());

$grid->initPager($totalRows, $rowsPerPage, $currentPage);

// Query DB
$rows = $usersTable->fetchAll($grid->getFilterCriteria(),
$grid->getSortCriteria(),$grid->getRowsPerPage(), $grid->getPageOffset());

$grid->populate($rows);

// Grid Renderer
$options = array(
'labels' => $this->_labels,
'pkname' => 'user_id',
'urlbase' => $this->view->url(array('page'=>'@@page@@'), null, false,
false),
'urledit' => $this->view->url(array('action'=>'edit',
'page'=>null)).'/@@id@@?Mmx_Back=1',
'urldelete'=>
$this->view->url(array('action'=>'delete')).'/@@id@@?Mmx_Back=1'
);

$grid->setDecorators($options);

$this->view->grid = $grid;

--
Laurent Melmoux
Conseils et Solutions Web | laurent@...
2mx - Annecy, France | http://www.2mx.fr/


Filipe Carvalho a écrit :

>
> Hi all,
>
> I'm looking for something like phpGrid (http://www.phpgrid.com/). Not
> so advanced... i will be happy in having out the box features like:
> - Paging
> - Sorting columns
> - Capability to create links values of some columns
>
> It is not hard to do it, but using model-view-controller pattern I
> can't realize how to do something clean and reusable.
>
> Can you give some clues how to do it?
>
> Best Regards,
>
> Filipe Carvalho
>

Re: Datagrid in Zend Framework

by Daniel Rossi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I generally use the PEAR structures_datagrid package. I have also used  
a funnky jquery table editor plugin, so the fields are all editable  
and updated via ajax.


On 08/05/2008, at 2:11 AM, Joó Ádám wrote:

> This looks neat – scaffolding and grid was already mentioned, would be
> great to have a ZF component for this job. Is there any ongoing
> development in this area?
>
>
> Regards,
> Ádám