Hello,
I just want to show how to create a better filter. You only have to add a little bit more code and the filter will work more specify.
assets/grocery_crud/themes/flexigrid/views/list_template.php
Line: 127 to 153
<div class="sDiv quickSearchBox" id='quickSearchBox' > <div class="sDiv2" style="width: 80%;"> <?php echo $this->l('list_search');?>: <select name="search_field" id="search_field"> <option value=""><?php echo $this->l('list_search_all');?></option> <?php foreach($columns as $column){?> <option value="<?php echo $column->field_name?>"><?php echo $column->display_as?> </option> <?php }?> </select> <select name="wildcard" id="wildcard"> <option value="equal">equal</option> <option value="not_equal">does not equal</option> <option value="begin">begins with</option> <option value="end">ends with</option> <option value="contain">contain</option> <option value="not_contain">does not contain</option> </select> <input type="text" class="qsbsearch_fieldox search_text" name="search_text" size="30" id='search_text'> <input type="button" value="<?php echo $this->l('list_search');?>" class="crud_search" id='crud_search'> </div> <div class='search-div-clear-button'> <input type="button" value="<?php echo $this->l('list_clear_filtering');?>" id='search_clear' class="search_clear"> </div> </div>
On the first picture you can see the few options.
[attachment=880:Options.jpg]
Now edit the file Grocery_CRUD.php.
Start at line 593.
application/libaries/Grocery_CRUD.php
elseif(isset($this->relation_n_n[$state_info->search->field])) { $escaped_text = $this->basic_model->escape_str($state_info->search->text); $this->having($state_info->search->field." LIKE '%".$escaped_text."%'"); } else { $wildcard = $_POST['wildcard']; if($wildcard == "equal") { $this->like($state_info->search->field , $state_info->search->text , 'none'); } elseif($wildcard == "not_equal") { $this->where($state_info->search->field.' !=', $state_info->search->text); } elseif($wildcard == "begin") { $this->like($state_info->search->field , $state_info->search->text , 'after'); } elseif($wildcard == "end") { $this->like($state_info->search->field , $state_info->search->text , 'before'); } elseif($wildcard == "contain") { $this->like($state_info->search->field , $state_info->search->text); } elseif($wildcard == "not_contain") { $this->where($state_info->search->field.' not like ', "%".$state_info->search->text."%"); } }
Thats all.
I wrote this because I didn't found something like this.
It isn't very much but I hope someone of you could use it for his own table. And I hope it will help somebody of you.