Jump to content


Multiple filter problem with GC when adding additional WHERE condition on ajax_list

where multiple where ajax_list grocery crud

  • Please log in to reply
1 reply to this topic

#1 ecx

ecx

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 31 January 2016 - 05:05 AM

Hi, 

 

I would like to ask for some help or maybe someone out there could point me to the right direction. 

 

I am new to using Grocery Crud and I have just started using GC on my project. 

 

What I am trying to do is to only show all items NOT marked as deleted so my table has a field called 'is_deleted' which have a default value of '0'.

 

I have added an additional where condition on my GC instance: 

$crud = new grocery_CRUD();
$crud->where('is_deleted', '0', true);
$crud->set_table($this->db->dbprefix('item'));

When the page first loads, it only shows all items that are not marked as deleted. Which is working as expected.

 

And on the list page, this option is not shown as a filter and should be hidden and default on the back-end. 

 

But when I start searching/filtering items the problem occurs. 

 

E.g: Search keyword is "test" and field is "ALL". GC returns all items from the table without applying any "where" condition as seen from the result being returned. 

 

Please also note that this only happens when the field selected is "ALL" but not when I set the field to a specific field the filtering works correctly. 

 

 

Any help/suggestion is highly appreciated. 

 

Thank you.



#2 ecx

ecx

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 02 February 2016 - 11:37 AM

Upon searching for solution on this problem I have seen an Issue on github and Doctor-Paul's commented code has been able to solve the problem. 

 

For anyone who might encounter the same problem you may check it here: 

 

https://github.com/s...crud/issues/341

 

 

 

Cheers!







Also tagged with one or more of these keywords: where, multiple where, ajax_list, grocery crud

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users