Prevent url parameter based column-search if columnfieldname not exists

QuestionsPrevent url parameter based column-search if columnfieldname not exists
Mario asked 8 years ago

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–&gt;
<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?

2 Answers
Abu Ghufran answered 8 years ago

Hello,
I've emailed you updated build that will ignore the filter if column is not found in url param.

selectcase.biz answered 8 years ago

Thank you. It works now. Great!

Your Answer

14 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?