Select to view content in your preferred language

communicating between custom widget and OOTB table widget

179
3
Jump to solution
3 weeks ago
wanderer1
Emerging Contributor

Hi

I am building a custom widget that makes a selection on the map. To have the corresponding rows highlighted in the OOTB table widget how do I go about doing this?

Can I use 

MessageManager.getInstance().publishMessage(
               new DataRecordsSelectionChangeMessage(props.widgetid, ds.records, [props.dataSource.id])
 
or do I need to extend the current table widget to listen to a new message I send from my custom widget?
 
Thanks
 
0 Kudos
1 Solution

Accepted Solutions
Allen_Zhang
Regular Contributor

Hi @wanderer1 ,you can try select the record by dataSource.selectRecordById(recordId, record) or dataSource.selectRecordsByIds(recordIdArray, recordArray).

The table will hightlight these records automatically.

View solution in original post

0 Kudos
3 Replies
Allen_Zhang
Regular Contributor

Hi @wanderer1 ,you can try select the record by dataSource.selectRecordById(recordId, record) or dataSource.selectRecordsByIds(recordIdArray, recordArray).

The table will hightlight these records automatically.

0 Kudos
wanderer1
Emerging Contributor

Hi @Allen_Zhang 

That is what I have tried doing and it does select on the map, but not in the table.

 

dataSource.query({ objectIds: [ "1","2"], returnGeometry : true }).then((qr) => {

          dataSource.selectRecordsByIds?.(
            qr.records.map((item) => item.getId())
          );

         
        });
0 Kudos
wanderer1
Emerging Contributor

Was missing the second argument. Thank you!

0 Kudos