Moved all of the jqGrid search javascript into its own file to prevent duplication when including more than one grid on a page. I also put search boxes directly into the jqGrid element, with the requested fields passed in as a parameter. I've got the autosearch mechanism tied across all grids, but search and reload is grid specific. This was mostly to get the code into an extensible spot, but the layout is not yet desirable. I'll yank the search boxes on the next checkin not that its proven out.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@123 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-14 23:16:35 +00:00
parent b6317d3ee9
commit b02695631e
5 changed files with 74 additions and 140 deletions

View File

@@ -11,25 +11,18 @@ $cols['First Name'] = array('index' => 'PrimaryContact.first_name', 'formatter
$cols['Leases'] = array('index' => 'lease_count', 'width' => '60');
$cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment');
echo $this->element('jqGrid',
array('jqGridColumns' => $cols));
$jqGrid_options = array('jqGridColumns' => $cols,
'controller' => 'customers',
'caption' => isset($caption) ? $caption : null);
?>
if (isset($customers)) {
$jqGrid_options += array('custom_ids' =>
array_map(create_function('$data',
'return $data["id"];'),
$customers),
'limit' => 5);
}
<div>Search By:<BR>
<input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)" CHECKED>Enable Autosearch<BR>
Last Name<BR>
<input type="text" CLASS="filt-text" id="filt_last_name" name="PrimaryContact.last_name" />
<button CLASS="filt-submit" ID="submit_filt_last_name" style="margin-left:30px;">Search</button><BR>
First Name<BR>
<input type="text" CLASS="filt-text" id="filt_first_name" name="PrimaryContact.first_name" />
<button CLASS="filt-submit" ID="submit_filt_first_name" style="margin-left:30px;">Search</button><BR>
<div>
<button CLASS="filt-clear" ONCLICK="gridRestore()">Clear</button>
</div>
</div>
$jqGrid_options += array('search_fields' => array('Last Name', 'First Name'));
echo $this->element('jqGrid', $jqGrid_options);