⚠ 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

Using WHERE clause and Flexigrid



pimnr47
  • profile picture
  • Member

Posted 01 July 2017 - 09:45 AM

Hi all,

 

I am so thankful for Grocery crud, it has sped up my development incredibly!

 

I would like to use the where clause. I tried using the parameter at the end of the url of my route, but that messes up the ajax call query and returns a 500:

 

   public function listsales($transactionId = null){

 

        $crud = new grocery_CRUD();
 
        $crud->set_theme('flexigrid');
        $crud->set_table('sale');
        
        $transactionId = $this->input->get('saletransactionId', TRUE);
        if(isset($transactionId)){
            $crud->where('saletransactionId', $transactionId);
        }

 

 

   //more grocery stuff...

   }

 

This works fine with datatables. Anyway, now I try it with a get parameter, like so:

 

   public function listsales(){

 

        $crud = new grocery_CRUD();
 
        $crud->set_theme('flexigrid');
        $crud->set_table('sale');
        
        $transactionId = $this->input->get('saletransactionId', TRUE);
        if(isset($transactionId)){
            $crud->where('saletransactionId', $transactionId);
        }

 

 

   //more grocery stuff...

   }

 

 

This works, but after a second, flexigrid reloads the table contents with an ajax call and ignores the where clause completely.

 

Any way to include the where clause in the async calls? Or prevent the first async call after page load would also work for me.

 

Thank you!

 

Cheers,

Pim