0
Respuestas

How to select/deselect a row in a catalog from a Javascript command?

patricio cubillos hace 5 meses actualizado por Deborah Baines hace 4 semanas 4

Hi,

Is it possible to select or de-select rows in a catalog thought the Javascript API?

Ultimately, I want to highlight targets as the user clicks into a list of the entries of the catalog (which is in a separate HTML component)

Thanks!

+1
Glad to hear! Yes there is: 

{event: 'deselectAllShapes'}

Best regards,
Philip Matsson

Awesome! It's working just as I needed!

Thanks!

PS: I can get by with this answer already, but it doesn't hurt to ask: is there also a 'deselectAllShape' type of command by any chance?

+1

Dear Patricio,

Yes, this is possible if you know the overlay name (i.e. it is a catalog you have added through 'overlayCatalogueWithDetails')

Example:

Adding the catalogue:
{event:'overlayCatalogueWithDetails', content:{'overlaySet': {'type': 'SourceListOverlay', 'overlayName': 'test catalogue name', 'cooframe': 'J2000', 'color': '#ee2345', 'lineWidth': 10, 'skyObjectList': [{'name': 'source name A', 'id': 1, 'ra': '150.44963', 'dec': '2.24640', 'data': [{'name': 'Flux 1', 'value': '10.5', 'type': 'STRING'}]}]}}}


De/selecting a shape (and a row):
{event: 'selectShape', content:{overlayName:'test catalogue name', shapeName:'source name A'}}
{event: 'deselectShape', content:{overlayName:'test catalogue name', shapeName:'source name A'}}

Best regards,
Philip Matsson