villebro edited a comment on issue #14709:
URL: https://github.com/apache/superset/issues/14709#issuecomment-844101647


   Something quite similar is already being leveraged in a few plugins, 
although in a slightly different context. As you may know, it's possible to 
fetch results for multiple queries in a single query context in `buildQuery`:
   
   ```
   queryContext = {
       queries: [
         queryObject1,
         queryObject2,
       ],
   }
   ```
   
   Now, to be able to add more query objects based on chart interaction you can 
call `setDataMask` and pass it a JSON object called `ownState`. Something like 
this:
   `setDataMask({ ownState: ['node1'] });`
   
   When you do that, `buildQuery` is retriggered, and you are able to access 
the `ownState` object in buildQuery like this:
   
   ```ts
   export default function buildQuery(formData: TableChartFormData, options) {
     const { ownState } = options;  // ['node1']
     ...
   }
   ```
   
   So anything that you've passed to `ownState` can be used to modify or add 
queries to the query context.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to