Jump to content


Bootstrap Not filtering when Paginate with Where clause

bootstrap theme bootstrap v3 where clause where

  • Please log in to reply
No replies to this topic

#1 Neo Fethi Ch

Neo Fethi Ch

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 20 May 2019 - 01:23 PM

Hi everyone, 

I purchased a bootstrap v3 Theme for grocery crud and apply it to my projet.

I have a probleme when i use Where condition on my table to get filtered data.

 

I explain it : For example i have to show Houses with certain conditions (a surface between 100 and 200), so i use PHP GET, and apply Where condition before getting the table.

 

For the first page of datatable list (bootstrap theme), it works. but when i click on pagination (page 2 3 4 etc), the filter is not considered, so the table shows all results without Filter.

 

It's very important for me because i used in big project for my customer. 

It will be very helpful if you can send me a solution for this. 

 

Here is the code : 
 

$crud = new grocery_CRUD();
			$crud->set_language('french');
			
			if(isset($_GET['admin']) && is_numeric($_GET['admin']) && (int)$_GET['admin']>0 ){
				$idadminfilter=(int)$_GET['admin'];
				$crud->where("cm_appartements.id_admin",$idadminfilter);
			}
			$supmin=0;
			$supmax = "";
			if(isset($_GET['supmin']) && is_numeric($_GET['supmin']) && (int)$_GET['supmin']>=0 ){
				$supmin = (int)$_GET['supmin'];
				$crud->where("superficie >=",$supmin);
			}
			if(isset($_GET['supmax']) && is_numeric($_GET['supmax']) && (int)$_GET['supmax']>0 ){
				$supmax = (int)$_GET['supmax'];
				$crud->where("superficie <=",$supmax);
			}
			
			$crud->set_table('cm_appartements')->order_by("id","desc");
			$crud->fields("id_residence","id_type_appartements","lot","bloc","numero","nombre_pieces","etage","superficie","prix_appartement","date_ajout","date_edition","id_admin","id_admin_edition","images");
			$crud->required_fields("id_residence","id_type_appartements","lot","bloc","nombre_pieces","etage","superficie");
			$crud->columns("id","id_residence","id_type_appartements","lot","bloc","nombre_pieces","etage","superficie","etat_vente","images","id_admin","date_ajout","id_admin_edition","date_edition");			






Also tagged with one or more of these keywords: bootstrap theme, bootstrap v3, where clause, where

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users