I am usuing your snippet fot search from an url parameter to have immediately a result when using a parameter from url.
If I pass filename.php?list1_colfieldname=searchedterm-
I get everything fine if the column to search is there.
But I get an error, when the column is not there. Sinde I use $_SERVER['QUERY_STRING'] in the urlall parameters are always transfered. I do not like to change this. So is there a possiblity not to use this skript, if the urlparameter is not there:
The snipped I got from you (which works if columnt is there) is:
<!– http://www.domain.com/filename.php?list1_colfieldname=searchedterm–>
<script>
// bind custom reload handler, required for url based filters
$(window).load( function () {
$('#refresh_list1').unbind( "click" );
$('#refresh_list1').click( function (event) {
reloadGrid();
});
});
// new handler for reload button – with postData
function reloadGrid()
{
var grid = $("#list1");
// reset default values of filters
var filters = grid[0].p.postData.filters;
for(var i in filters.rules)
{
var f = filters.rules[i].field;
var d = filters.rules[i].data;
$('input[id="gs_'+f+'"]').val(d);
}
grid.trigger("reloadGrid",[{page:1}]);
}
</script>
<!– snippet for url filter end–>
Could you tell how to stop the script working if column is NOT there?
Hello,
I've emailed you updated build that will ignore the filter if column is not found in url param.