Skip to content

prevent first ajax submition#66

Open
faoliva wants to merge 3 commits intodudapiotr:masterfrom
faoliva:master
Open

prevent first ajax submition#66
faoliva wants to merge 3 commits intodudapiotr:masterfrom
faoliva:master

Conversation

@faoliva
Copy link
Copy Markdown

@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

faoliva added 3 commits April 30, 2015 17:12
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