Got the mulitcolumn search toolbar in place, but it's not working. First I haven't managed to get an autosearch working (searching as you type). Second, and much more critically, I don't have the controller correctly responding to search terms, as it was implemented rather poorly. I'm moving on for now.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@113 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -35,6 +35,10 @@ $cols['Comment'] = array('index' => 'Customer.comment', 'width' =>
|
||||
foreach (array_intersect_key($cols, array('Comment'=>1)) AS $k => $v)
|
||||
$cols[$k]['sortable'] = false;
|
||||
|
||||
// Some of the columns should be searchable
|
||||
foreach (array_intersect_key($cols, array('Last Name'=>1, 'First Name'=>1)) AS $k => $v)
|
||||
$cols[$k]['search'] = true;
|
||||
|
||||
// Create the javascript code for jqGrid to create each table column
|
||||
$colModels = array();
|
||||
foreach ($cols AS $col) {
|
||||
@@ -43,7 +47,7 @@ foreach ($cols AS $col) {
|
||||
'{ ' . implode(", ",
|
||||
array_map(create_function
|
||||
('$k, $v',
|
||||
'return "$k:".($v===false?"false":"\'$v\'");'),
|
||||
'return "$k:".($v===false?"false":($v===true?"true":"\'$v\'"));'),
|
||||
array_keys($col),
|
||||
array_values($col))) .
|
||||
'}';
|
||||
@@ -70,8 +74,8 @@ $url = $html->url(array('controller' => 'customers',
|
||||
?>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
// return;
|
||||
jQuery("#customer-list").jqGrid({
|
||||
url: '<?php echo $url; ?>',
|
||||
datatype: 'xml',
|
||||
@@ -89,21 +93,46 @@ jQuery(document).ready(function(){
|
||||
viewrecords: true,
|
||||
imgpath: '<?php echo $imgpath; ?>',
|
||||
caption: <?php echo $caption ? "'$caption'" : "null"; ?>,
|
||||
toolbar : [true,"bottom"],
|
||||
});
|
||||
|
||||
jQuery("#t_customer-list").height(25).hide()
|
||||
.filterGrid("#customer-list", {
|
||||
gridModel:true,
|
||||
gridToolbar:true,
|
||||
autosearch:true,
|
||||
});
|
||||
|
||||
jQuery("#customer-list").navGrid('#customer-pager',
|
||||
{ view:false,
|
||||
edit:false,
|
||||
add:false,
|
||||
del:false,
|
||||
search:false,
|
||||
refresh:false})
|
||||
.navButtonAdd("#customer-pager",{
|
||||
caption:"Search",
|
||||
title:"Toggle Search",
|
||||
buttonimg:'<?php echo $imgpath; ?>' + '/find.gif',
|
||||
onClickButton:function(){
|
||||
if(jQuery("#t_customer-list").css("display")=="none") {
|
||||
jQuery("#t_customer-list").css("display","");
|
||||
} else {
|
||||
jQuery("#t_customer-list").css("display","none");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
--></script>
|
||||
|
||||
<div id="everything">
|
||||
<table id="customer-list" class="scroll"></table>
|
||||
<div id="customer-pager" class="scroll" style="text-align:center;"></div>
|
||||
</div>
|
||||
|
||||
<div class="h">Search By:</div>
|
||||
<div>
|
||||
<input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)">Enable Autosearch
|
||||
</div>
|
||||
<div>Last Name<br>
|
||||
<div>Search By:<BR>
|
||||
<input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)">Enable Autosearch<BR>
|
||||
Last Name<BR>
|
||||
<input type="text" id="filt_last_name" onkeydown="doSearch(arguments[0]||event)" />
|
||||
<button onclick="gridReload()" id="submitButton" style="margin-left:30px;">Search</button>
|
||||
</div>
|
||||
@@ -139,13 +168,3 @@ function gridReload() {
|
||||
|
||||
--></script>
|
||||
|
||||
<?php
|
||||
/* <div><a href="#" onClick="$('#debug').html(htmlEncode($('#everything').html())); return false;">Get Table Code</a></div> */
|
||||
/* <div id="debug"></div> */
|
||||
|
||||
/* <P> */
|
||||
/* <input type="text" id="debval" value="1.0em"><BR> */
|
||||
/* <a href="#" onClick="$('#load_customer-list').css('display', 'inline'); return false;">Show Loading</a><BR> */
|
||||
/* <a href="#" onClick="$('#load_customer-list').css('margin-top', $('#debval').val()); return false;">Set Top Margin</a><BR> */
|
||||
/* <a href="#" onClick="$('#load_customer-list').css('margin-left', $('#debval').val()); return false;">Set Left Margin</a><BR> */
|
||||
?>
|
||||
Reference in New Issue
Block a user