Resetting Search Boxes button

QuestionsResetting Search Boxes button
Glenn asked 9 years ago

Hi Abu,

I tried to use some code in this forum for resetting or clearing the filter.
Button appears, but I get an sql error when it tries to refresh.
http://websalesdesign.com/proj/lib/phpgrid-full/demos/appearence/alternate-row.php
http://websalesdesign.com/proj/lib/phpgrid-full/index.php

Below is the code.

</script>
<script type="text/javascript">

jQuery(document).ready(function(){

jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager',
{
'caption' : 'Reload',
'buttonicon' : 'ui-icon-refresh',
'onClickButton': function()
{
var myGrid = jQuery("#list1");
jQuery("span.s-ico",myGrid[0].grid.hDiv).hide(); // hide sort icons

// reset filters and sort field
myGrid.setGridParam({ postData: { filters: JSON.stringify({groupOp: "AND", rules:[]}) }, sortname: ''}).trigger('reloadGrid');

// empty toolbar fields
jQuery(".ui-search-input input").val("");

},
'position': 'last'
});
});

</script>

2 Answers
Abu Ghufran answered 9 years ago

Ok, the lib will need a fix for this tweak.
Edit jqgrid_dist.php:

Search:
$qwery = " AND ( $qwery )";

Replace with:

if (!empty($qwery))
$qwery = " AND ( $qwery )";

Glenn answered 9 years ago

Thanks Abu
That fixed it.

Your Answer

14 + 3 =

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?