Active
Project:
Ajax Table
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Jul 2008 at 14:35 UTC
Updated:
21 Jul 2008 at 11:00 UTC
I was having problems using queries with GROUP BY so I modified _ajaxtable_render() so now it works. I have modified ajaxtable.module:263 so it now looks like this:
if ($search_query) {
$search_query = ' (' . $search_query . ') ';
if (strpos($table['query'],'WHERE') > 0) {
$connect = ' AND ';
} else {
$connect = ' WHERE ';
}
if (strpos($table['query'], "GROUP BY")) {
$table['query'] = str_replace('GROUP BY ', $connect . $search_query.' GROUP BY ', $table['query']);
}else {
if (strpos($table['query'], "HAVING")) {
$table['query'] = str_replace('HAVING ', $connect . $search_query.' HAVING ', $table['query']);
}else {
if (strpos($table['query'], "ORDER BY")) {
$table['query'] = str_replace('ORDER BY ', $connect . $search_query.' ORDER BY ', $table['query']);
} else {
$table['query'] .= $connect . $search_query;
}
}
}
}
It should also work with queries using HAVING; but I haven't tested it.
How could this changes make it to the module? I am doing other modifications to the module which I think can be useful to other developers.
Comments
Comment #1
ArvindSingh commentedCheck with Stompeers. There is support request titled ' Any maintainers for Ajaxtable?' and Stompeers is looking for co-maintainers.
Meanwhile, since i'm using Ajaxtable in active development. I'll evaluate some of the fixes you have submitted.
Cheers