1. The keyup or keydown is not the best way. EVERY key causes the event to fire.
2. After the initial character entry, I get a list in the grid. After that I only get a blank grid.
<script type="text/javascript">
var Vnamesuggest = '';
function initSBScript() {
$(document).ready(function() {
CloseGrid = function() {
$('##userslistdiv').pqGrid('destroy');
$('##userslistdiv').hide;
}
$('.namesuggestselector').on('keyup', function() {
Vnamesuggest = $.trim(this.value);
//alert(Vnamesuggest);
$('##userslistdiv').show();
var colM = [{
title: 'IndivID',
width: 60,
dataType: 'integer',
editable: false
}, {
title: 'Name',
width: 150,
dataType: 'string',
editable: false
}, {
title: 'Company',
width: 200,
dataType: 'string',
editable: false
}, {
title: 'City',
width: 150,
dataType: 'string',
editable: false
}];
var dataModel = {
location: 'remote',
dataType: 'JSON',
method: 'GET',
paging: 'local',
rPP: 15,
rPPOptions: [15, 30, 45],
getUrl: function() {
return {
url: 'cfc/basic.cfc?method=getIndivs&namesuggest=' + Vnamesuggest
};
},
getData: function(response) {
return {
data: response.DATA
};
}
}
$('##userslistdiv').pqGrid({
width: 560,
height: 470,
title: 'Select Participant',
dataModel: dataModel,
colModel: colM,
scrollModel: {
horizontal: false
},
flexHeight: true,
cellClick: function(evt, ui) {
var $td = $(evt.currentTarget).closest('td');
if ($.isNumeric($td.text())) {
GSIDval = $td.text();
alert(GSIDval);
};
}
});
});
});
};
</script>