Project:Ajax Table
Version:5.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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:

<?php
   
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

#1

Check 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

nobody click here