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@114 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-14 04:40:47 +00:00
parent 336ec3b643
commit 6b8d05f2a0
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']) {
$searches[] = array('op' => 'bw',
'field' => $params['filtField'],
'value' => $params['filtString']);
'value' => $params['filtValue']);
}
else {
return array();

View File

@@ -93,35 +93,35 @@ jQuery(document).ready(function(){
viewrecords: true,
imgpath: '<?php echo $imgpath; ?>',
caption: <?php echo $caption ? "'$caption'" : "null"; ?>,
toolbar : [true,"bottom"],
/* toolbar : [true,"bottom"], */
});
jQuery("#t_customer-list").height(25).hide()
.filterGrid("#customer-list", {
gridModel:true,
gridToolbar:true,
autosearch:true,
});
/* 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");
}
}
});
/* 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"); */
/* } */
/* } */
/* }); */
});
@@ -132,39 +132,88 @@ jQuery(document).ready(function(){
<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>
<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>
<div ID="debug"></div>
<script type="text/javascript"><!--
var timeoutHnd;
var flAuto = false;
function enableAutosubmit(state) {
flAuto = state;
jQuery("#submitButton").attr("disabled",state);
}
function doSearch(ev){
if(!flAuto)
return;
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(gridReload,500);
timeoutHnd = setTimeout(function()
{gridFilter(id)},
500);
}
}
function gridReload() {
var str = jQuery("#filt_last_name").val();
jQuery("#customer-list").setGridParam( {
url: '<?php echo $url; ?>' + '?filt=1' +
'&filtField=PrimaryContact.last_name' +
'&filtString=' + str,
page:1
}).trigger("reloadGrid");
function enableAutosubmit(state) {
jQuery(".filt-submit").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 gridRestore() {
/* $('#debug').append("RESTORE<BR>"); */
$('.filt-text').val('');
jQuery("#customer-list").removePostDataItem('filt');
jQuery("#customer-list").removePostDataItem('filtField');
jQuery("#customer-list").removePostDataItem('filtValue');
jQuery("#customer-list")
.setGridParam({ page: 1 })
.trigger("reloadGrid");
}
function gridFilter(id) {
var field = jQuery("#"+id).attr('name');
var value = jQuery("#"+id).val();
/* $('#debug').append("RELOAD: field:"+field+"; value:"+value+"<BR>"); */
jQuery("#customer-list").setPostDataItem('filt', true);
jQuery("#customer-list").setPostDataItem('filtField', field);
jQuery("#customer-list").setPostDataItem('filtValue', value);
$('.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>