operator set to like, search_values didn't populate
jbizzay - April 10, 2008 - 03:45
| Project: | Ajax Table |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
I used this module to create an alternative to admin/content and it works great. I found I had to add one line of code to make it work, in ajaxtable.module ln 299:
$search_values[] = $_GET[$id . $input['id']];BTW, here is my form code, which is joining the node table to the user table:
function ajaxtable_table_nodesearch($override='') {
$table = array(
'edit' => true,
'delete' => true
);
$search_inputs = array(
array(
'type' => 'text',
'id' => 'author_search',
'help_title' => 'Author Search',
'help' => 'Search by UserName of Author',
'operator' => 'like',
//'jointable' => 'users',
'col' => 'jt.name',
'size' => 8
)
);
$inputs = ajaxtable_search_inputs($search_inputs);
$theme['search'] = '
<table class="ajaxtable-default-search-table">
<tr>
<td class="ajaxtable-default-search-table-left"></td>
<td>{search_help}</td><td>Search for {search_input} </td>
<td> | With this username: ' . $inputs['author_search']['input'] . '</td>
<td>' . $inputs['author_search']['help'] . '</td>
<td>{search_button}</td>
<td class="ajaxtable-default-search-table-right"></td>
</tr>
</table>
';
$override = array(
'search_inputs' => $search_inputs,
'theme_override' => $theme,
'query' => ' SELECT * FROM {node} as n INNER JOIN {users} as jt '
.' ON n.uid = jt.uid ',
'columns' => array(
array(
'col' => 'nid',
'label' => 'ID',
'sortable' => TRUE,
'searchable' => TRUE,
'help' => 'The unique node ID.',
),
array(
'col' => 'title',
'label' => 'Title',
'sortable' => TRUE,
'searchable' => TRUE,
'help' => 'The title of the node.',
),
array(
'col' => 'name',
'label' => 'AuthorName',
'sortable' => TRUE,
'searchable' => TRUE,
// 'callback' => 'ajaxtable_col_authorname',
'help' => 'Nodes authored by this authorname',
),
),
);
ajaxtable_override($table,$override);
return $table;
}