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

Conversation

faoliva
Copy link

@faoliva faoliva commented Apr 30, 2015

Since i can render a zfTable in first request of a page, its necesary to prevent the first ajax

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');
			}
		});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant