zepernick / Codeigniter-DataTables

CodeIgniter Library For Ajax Server Side DataTables 1.10 >
MIT License
94 stars 95 forks source link

Having problem regarding whereClauseArray() #27

Open takerukimura opened 8 years ago

takerukimura commented 8 years ago

Hi Zepernick,

Im having problem regarding whereClauseArray() function. What I want to do is using where clause to find event_id = $_GET['id]. So I wrote like this : public function whereClauseArray(){ $conditions = array(); $conditions['event_id ='] = $this->input->get('id'); return $conditions; } But it can't find any data. If I do like this : public function whereClauseArray(){ $conditions = array(); $conditions['event_id ='] = 5; return $conditions; } The data will come out. Is there any specific method to using value from $_GET ?

FayazK commented 7 years ago

Hi, As we call that class via ajax so you have to pass url query args with the URL you are calling AJAx

let say posts is your controller and there is a method doajax where your DataTable logic is so you are calling http://someone.com/posts/doajax

in the jquery of your DataTable.

Now the magic is here. you have to pass the $_GET args here like http://someone.com/posts/doajax?id=1

Hope it will help