You can see an example of implementation at the link https://web.flatris.com.ua/gbuttons.html
To implement a list of objects when you click on the "Apartments" button, you should add the cid_list parameter to the script URL with a comma-separated list of required cid objects:
In the above example, it was added to the script:
&cid_list=QJXPgWMdaxpjkzZ,LoZEv6ePY9W1qwP,e2wa90Q48p6rXLA
You can get the object cid parameter from the JS script that is generated for each object: