Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing and hiding check boxes #171

Open
ready4data opened this issue Sep 25, 2018 · 3 comments
Open

Clearing and hiding check boxes #171

ready4data opened this issue Sep 25, 2018 · 3 comments

Comments

@ready4data
Copy link

I modified the code for the check boxes to hide the ones with (0) items after filtering.

      var c = $(this), count = 0
      if(result.length > 0){
        count = jQ.where({ 'litType': c.val() }).count;
      }
	  //hide the checkboxes if value is 0////////
	  if (count ==0) { 
		  $('#'+c.val().replace(/\s/g, '')).hide();
	  }	else {
		  $('#'+c.val().replace(/\s/g, '')).show();
	  }	  
      c.next().text(c.val() + '(' + count + ')')
    });```

I'm trying to figure out how to uncheck All and the items that are left so 
the user can just pick the item they want. Currently they have to first 
uncheck All, then check the item they actually want.
@PeterPan73
Copy link

Hi @ready4data did you find any solution? And I'm interested in that.

@ready4data
Copy link
Author

I did do this which works but produces some unexpected filtering.
I have two different sections with checkboxes Literature Type and Product Type
After entering your search terms, the page refreshes and the checkboxes are all unchecked.
If I check off an item it either area, it works. If I select an item in one area and then the other, it gives unexpected results in the search.

function afterFiltered(){//Unchecks the boxes after a search
  $('#litType_criteria :checkbox').prop('checked', false);
 /$('#prodType_criteria :checkbox').prop('checked', false);  
}

And added that function to the callback.

@PeterPan73
Copy link

Thanks for the answer. But if all are unchecked by default, when you checked one of the checkbox, the counter of the others is reset(will be 0). Did you find any solution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants