Is server side pagination works in max function also?
Is server side pagination works in max function also?
Renuad
Posts: 3Questions: 1Answers: 0
I am facing problem while using server side validation while searching i.e in particular case, if I use max or count function in my mysql query its fails to search and sorting also, in that particular column rest it works fine.
Is datatables server side pagination doesn't work in max function?
This discussion has been closed.
Answers
Hi @Renaud ,
I may be missing something, and if so I apologise, but the server-side scripts for
serverSide
just return data in the expected format. How you extract or generate that data is up to you - we provide samples that you can modify, but provided you're using valid SQL it wouldn't be a problem. If I'm missing the point, could you elaborate please,Cheers,
Colin
Let me explain what exactly i am facing:
here is my code with query:
$column_search =array('att.emp_id','u.Name','date_format(att.added_date, "%d-%m-%Y")','pg.key_geographic_area','TIMESTAMPDIFF(HOUR,min(att.added_date),max(att.added_date))','min(att.added_date)','max(att.added_date)');
$column_order = array(null,'att.emp_id','u.Name','date_format(att.added_date, "%d-%m-%Y")','pg.key_geographic_area','TIMESTAMPDIFF(HOUR,min(att.added_date),max(att.added_date))','min(att.added_date)','max(att.added_date)');
$this->db->_protect_identifiers=false;
$order = array('date_format(att.added_date, "%Y-%m-%d %H:%i:%s")'=> 'desc');
$this->db-> select('att.emp_id,att.id,u.Name,pg.key_geographic_area,date_format(att.added_date, "%d-%m-%Y") as punchdate,max(att.added_date) as last_punch,min(att.added_date) as first_punch,TIMESTAMPDIFF(HOUR,min(att.added_date),max(att.added_date)) as duration');
$this->db->from(' pmc_attendance att,tbl_admin_users u,tbl_attendance_photo p,tbl_executive_geography_mapping m,tbl_project_geography pg');
$this->db->where('att.project_id',$project_id);
$this->db->where('att.punch_status',1);
$this->db->where('date_format(att.added_date, "%H:%i")<','09:15');
$this->db->where('u.emp_id','att.emp_id',false);
$this->db->where('m.emp_id' ,'u.emp_id',false);
$this->db->where('m.key_geographic_id','pg.id',false);
$this->db->where('p.pmc_id','att.id',false);
$this->db->where('date_format(att.added_date, "%Y-%m-%d")=curdate()');
$this->db->where('u.status','1');
$this->db->group_by('att.emp_id, date_format(att.added_date, "%Y-%m-%d")');
I want to search with column having max function also but it fails and throws error invalid group function when i search or asc / desc that particular column.
but if i want to search column data having max/min function haow can i achieved this.
What server-side library are you using there? We don't publish any that supports a GROUP BY, so I'm guessing either you are using your own server-side code or a third party one?
I'd suggest trying to echo out the SQL that is generated to see where the error is.
Allan
I m using data tables server side library.
I have tried to echo my sql result but nothing helps out :
its shows no error and searching not working in it.
Can you link to the library you are using please? As I say, we don't publish one which supports
group_by
. The semantics above aren't a library that I immediately recognise.What is the SQL that it generates?
Allan