Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent first ajax submition #66

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Commits on Apr 30, 2015

  1. prevent first ajax submition

    Since i can render a zfTable in first request of a page, its necesary to prevent the first ajax request. This is my code:
    PHP Contoller:
    	//first request
    	public function listarAction() {
    
    		$urlTabla = "/abm/ajax/rol" //
    		$tabla = $this->renderTabla() 
    		return [
    			'url' => $urlTabla,
    			'tabla' => $tabla
    		];
    	}
    	//ajax request
    	public function ajaxAction() {
    		
    		return $this->htmlResponse$this->renderTabla());
    	}
    	//return ZfTable rendered
    	protected function renderTabla(){
    		/* @var $tabla \Abm\Table\AbmTabla */
    		$tabla = $this->getServiceLocator()->get('abmTabla'); //abmTabla extends ZfTable\AbstractTable
    		
    		$tabla->setHeaders(....); //seting headers 
    		$tabla->setConfig(.....); //setting config
    		
    		$tabla->setAdapter($this->getDbAdapter())
    			->setSource($qb) //seting query 
    			->setParamAdapter($this->getRequest()->getPost());
    		
    		return $tabla->render();
    	}
    
    MY JS
    		tabla.zfTable(url, {
    
    			onInit: function() {
    				return false;
    			},
    			complete: function(){
    				console.log('complete');
    				$('.form-inline').removeClass('form-inline')
    						.addClass('form')
    						.find('.filter').addClass('input-sm');
    			}
    		});
    faoliva committed Apr 30, 2015
    Configuration menu
    Copy the full SHA
    b691dd4 View commit details
    Browse the repository at this point in the history
  2. Update zf-table.js

    faoliva committed Apr 30, 2015
    Configuration menu
    Copy the full SHA
    6fd2ac2 View commit details
    Browse the repository at this point in the history
  3. Update zf-table.js

    faoliva committed Apr 30, 2015
    Configuration menu
    Copy the full SHA
    f2f64cb View commit details
    Browse the repository at this point in the history