js can manipulate any data it gets from a php script. For instance, a php script could write values into a js array:
Is there a way to do this with JS?
php could also insert those values in the html to be displayed on initial page load. Thereafter, depending on what the user clicks, js can retrieve portions of the data in the array.
var arr = [
echo value1 . ',' ;
echo value2 . ',' ;
A simple scheme might involve using php to insert values in the html with groups of data having the same value for the class attribute(or a custom attribute of your choosing). Then if button1 is clicked, only elements with the class value 'group1' can be made visible. If button2 is clicked, then only elements with the class value 'group2' are made visible, etc.