Yanked the multicolumn toolbar, and returned to my simple text boxes. I will probably end up going with these search boxes, or the modal box (perhaps with autosearch) if I can't come up with a better idea.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@114 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-14 04:40:47 +00:00
parent 25677ffa5e
commit 06a4a25be8
2 changed files with 97 additions and 48 deletions

View File

@@ -182,7 +182,7 @@ class AppController extends Controller {
elseif (isset($params['filt']) && $params['filt']) { elseif (isset($params['filt']) && $params['filt']) {
$searches[] = array('op' => 'bw', $searches[] = array('op' => 'bw',
'field' => $params['filtField'], 'field' => $params['filtField'],
'value' => $params['filtString']); 'value' => $params['filtValue']);
} }
else { else {
return array(); return array();

View File

@@ -93,35 +93,35 @@ jQuery(document).ready(function(){
viewrecords: true, viewrecords: true,
imgpath: '<?php echo $imgpath; ?>', imgpath: '<?php echo $imgpath; ?>',
caption: <?php echo $caption ? "'$caption'" : "null"; ?>, caption: <?php echo $caption ? "'$caption'" : "null"; ?>,
toolbar : [true,"bottom"], /* toolbar : [true,"bottom"], */
}); });
jQuery("#t_customer-list").height(25).hide() /* jQuery("#t_customer-list").height(25).hide() */
.filterGrid("#customer-list", { /* .filterGrid("#customer-list", { */
gridModel:true, /* gridModel:true, */
gridToolbar:true, /* gridToolbar:true, */
autosearch:true, /* autosearch:true, */
}); /* }); */
jQuery("#customer-list").navGrid('#customer-pager', /* jQuery("#customer-list").navGrid('#customer-pager', */
{ view:false, /* { view:false, */
edit:false, /* edit:false, */
add:false, /* add:false, */
del:false, /* del:false, */
search:false, /* search:false, */
refresh:false}) /* refresh:false}) */
.navButtonAdd("#customer-pager",{ /* .navButtonAdd("#customer-pager",{ */
caption:"Search", /* caption:"Search", */
title:"Toggle Search", /* title:"Toggle Search", */
buttonimg:'<?php echo $imgpath; ?>' + '/find.gif', /* buttonimg:'<?php echo $imgpath; ?>' + '/find.gif', */
onClickButton:function(){ /* onClickButton:function(){ */
if(jQuery("#t_customer-list").css("display")=="none") { /* if(jQuery("#t_customer-list").css("display")=="none") { */
jQuery("#t_customer-list").css("display",""); /* jQuery("#t_customer-list").css("display",""); */
} else { /* } else { */
jQuery("#t_customer-list").css("display","none"); /* jQuery("#t_customer-list").css("display","none"); */
} /* } */
} /* } */
}); /* }); */
}); });
@@ -132,39 +132,88 @@ jQuery(document).ready(function(){
<div>Search By:<BR> <div>Search By:<BR>
<input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)">Enable Autosearch<BR> <input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)">Enable Autosearch<BR>
Last Name<BR> Last Name<BR>
<input type="text" id="filt_last_name" onkeydown="doSearch(arguments[0]||event)" /> <input type="text" CLASS="filt-text" id="filt_last_name" name="PrimaryContact.last_name" />
<button onclick="gridReload()" id="submitButton" style="margin-left:30px;">Search</button> <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>
</div>
<div ID="debug"></div>
<script type="text/javascript"><!-- <script type="text/javascript"><!--
var timeoutHnd; var timeoutHnd;
var flAuto = false; function handleFiltKeydown(e){
/* $('#debug').append("KEYDOWN: id:"+id+"<BR>"); */
if (e.which == 8 || e.which == 46 || /* Backspace / Delete */
e.which == 32 || /* Space */
(65 <= e.which && e.which < 65 + 26) || /* Upper Case */
(97 <= e.which && e.which < 97 + 26)) /* Lower Case */
{
var id = $(this).attr('id');
if(timeoutHnd)
clearTimeout(timeoutHnd);
timeoutHnd = setTimeout(function()
{gridFilter(id)},
500);
}
}
function enableAutosubmit(state) { function enableAutosubmit(state) {
flAuto = state; jQuery(".filt-submit").attr("disabled",state);
jQuery("#submitButton").attr("disabled",state); if (state) {
$(".filt-text").keydown(handleFiltKeydown);
/* $('#debug').append("BIND: id:"+id+"<BR>"); */
}
else {
$(".filt-text").unbind('keydown', handleFiltKeydown);
/* $('#debug').append("UNBIND: id:"+id+"<BR>"); */
}
} }
function doSearch(ev){ function gridRestore() {
if(!flAuto) /* $('#debug').append("RESTORE<BR>"); */
return; $('.filt-text').val('');
jQuery("#customer-list").removePostDataItem('filt');
if(timeoutHnd) jQuery("#customer-list").removePostDataItem('filtField');
clearTimeout(timeoutHnd); jQuery("#customer-list").removePostDataItem('filtValue');
jQuery("#customer-list")
timeoutHnd = setTimeout(gridReload,500); .setGridParam({ page: 1 })
.trigger("reloadGrid");
} }
function gridReload() { function gridFilter(id) {
var str = jQuery("#filt_last_name").val(); var field = jQuery("#"+id).attr('name');
jQuery("#customer-list").setGridParam( { var value = jQuery("#"+id).val();
url: '<?php echo $url; ?>' + '?filt=1' + /* $('#debug').append("RELOAD: field:"+field+"; value:"+value+"<BR>"); */
'&filtField=PrimaryContact.last_name' + jQuery("#customer-list").setPostDataItem('filt', true);
'&filtString=' + str, jQuery("#customer-list").setPostDataItem('filtField', field);
page:1 jQuery("#customer-list").setPostDataItem('filtValue', value);
}).trigger("reloadGrid");
$('.filt-text').each(function(){
if ($(this).attr('id') != id)
$(this).val('');
});
jQuery("#customer-list")
.setGridParam({ page: 1 })
.trigger("reloadGrid");
} }
$('.filt-submit').click(function(){
gridFilter($(this).attr('id').replace(/^submit_/, ''));
});
--></script> --></script>