⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Bootstrap Not filtering when Paginate with Where clause



Neo Fethi Ch
  • profile picture
  • Member

Posted 20 May 2019 - 13: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");