You can acheive this using Data Functions and IronPython scripting. Check the following knowledge base article on how to trigger an IronPython script upon marking,
https://support.tibco.com/s/article/Tibco-KnowledgeArticle-Article-45663
You can use the below script to toggle the details on demand panel based on marking,
from Spotfire.Dxp.Data import *
#get the table which will be marked
table=Document.Data.Tables["SalesAnzzdMarketing"]
#get the current data selection
dataSelection=Document.ActiveMarkingSelectionReference
#get the row selections
rowSelection=dataSelection.GetSelection(table)
# check the row count in the markings selected
rowCount= rowSelection.IncludedRowCount
#get the DOD panel
panel=Document.ActivePageReference.DetailsOnDemandPanel
#check if marked rows are 0 or more and toggle the DOD panel
if rowCount==0 :
if (panel.Visible):
panel.Visible=False
else:
if(panel.Visible==False):
panel.Visible=True
You can also check the following custom extension that can be used instead of a data function,
https://community.spotfire.com/wiki/custom-datetime-data-function-tibco-spotfire