Skip to content

Instantly share code, notes, and snippets.

@Hounddog
Created October 26, 2012 20:20
Show Gist options
  • Save Hounddog/3961251 to your computer and use it in GitHub Desktop.
Save Hounddog/3961251 to your computer and use it in GitHub Desktop.
JGrid Logic
<?php
$this->headScript()->append('my.js');
?>
implement the javascripthere
<?php
foreach(data['cols'] as $colum) {
echo 'generating some columns';
}
<?php
namespace Application\View\Helper;
use Zend\View\Helper\AbstractHelper;
use Zend\View\Model\ViewModel;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use Zend\ServiceManager\ServiceManager;
class JGridView extends AbstractHelper implements ServiceManagerAwareInterface
{
protected $serviceManager;
protected $viewTemplate;
public function __invoke($options)
{
//get data here or data from service manager
$vm = new ViewModel();
$vm->setTemplate('application/jgrid-view.phtml');
return $this->getView()->render($vm);
}
public function setViewTemplate($viewTemplate)
{
$this->viewTemplate = $viewTemplate;
return $this;
}
//getter/setter service Manager
}
<?php echo jGridView(array('url' => 'url/to/fetch/from', 'layout' => $this->jgridLayout[1]); ?>
<!-- i will put as many grids here as i wish and the controller cannot stop me! -->
?php echo jGridView(array('url' => 'url/to/fetch/from', 'layout' => $this->jgridLayout[2]); ?>
?php echo jGridView(array('url' => 'url/to/fetch/from', 'layout' => $this->jgridLayout[3]); ?>
?php echo jGridView(array('url' => 'url/to/fetch/from', 'layout' => $this->jgridLayout[4]); ?>
?php echo jGridView(array('url' => 'url/to/fetch/from', 'layout' => $this->jgridLayout[5]); ?>
?php echo jGridView(array('url' => 'url/to/fetch/from', 'layout' => $this->jgridLayout[6]); ?>
?php echo jGridView(array('url' => 'url/to/fetch/from', 'layout' => $this->jgridLayout[7]); ?>
?php echo jGridView(array('url' => 'url/to/fetch/from', 'layout' => $this->jgridLayout[8]); ?>
?php echo jGridView(array('url' => 'url/to/fetch/from', 'layout' => $this->jgridLayout[9]); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment