cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
avin
Regular Visitor

withTable selection selecting wrong row

 

I've encountered an issue when using the withTable selection with a map-based custom visual that I'm developing using Leaflet. The wrong row is selected when I create the selection in the custom visual. To demonstrate this, I put the same data passed to the custom visual in a native table visual.

 

When I click on the table visual, it shows a specific segment in the custom visual:

select_row.png

 

But when I click on the segment in the custom visual, it shows a different row in the table:

select_segment.png

 

I am using the v2.6.0 of the API. Simplified code is below. What am I doing wrong?

 

capabilities.json

 

 

{
  "dataRoles": [
    {
      "displayName": "Geometry (WKT)",
      "kind": "Grouping",
      "name": "geometry"
    },
    {
      "displayName": "Volume Count",
      "kind": "Measure",
      "name": "count"
    },
    {
      "displayName": "Tooltips",
      "kind": "Grouping",
      "name": "tooltips"
    }
  ],
  "dataViewMappings": [
    {
      "table": {
        "rows": {
          "select": [
            { "for": { "in": "geometry" } },
            { "for": { "in": "count" } },
            { "for": { "in": "tooltips" } }
          ]
        }
      }
    }
  ]
}

 

 

 

visual.ts

 

 

public update(options: VisualUpdateOptions) {
  const table = options.dataViews[0].table;
  table.rows.forEach((row, index) => {
    // Generate line geometry from data
    const line = ...

    // Selection
    const selectionId = this.host.createSelectionIdBuilder()
      .withTable(table, index)
      .createSelectionId();

    const polyline = L.polyline(line)
      .on("click", () => { this.selectionManager.select(selectionId); })
      .addTo(this.map);
  });
}

 

 

 

 

1 ACCEPTED SOLUTION
avin
Regular Visitor

I ended up switching to using a Basic Filter from the Visual Filters API instead of Selection and everything worked.

View solution in original post

2 REPLIES 2
avin
Regular Visitor

I ended up switching to using a Basic Filter from the Visual Filters API instead of Selection and everything worked.

View solution in original post

avin
Regular Visitor

I tried updating to the Visuals API 3.5.1, but I'm still encountering the same issue.

 

I also tried packaging the visual and trying it in Desktop, but still encountering the same issue.

 

An easier way to demonstrate is to duplicate the custom visual on the page. When I select the rows in one custom visual, the same number of rows is passed to the other custom visual, but not the same rows.

 

I tried investigating at the identityIndex from the selectionId.getKey(), but that seems like it's an index local to the visual itself.

 

Any ideas on what to investigate next?

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors
Top Kudoed Authors