Qna class

The Power BI Q&A embed component

Extends

Embed

Methods

configChanged(boolean)

Handle config changes.

getId()

The ID of the Q&A embed component

setQuestion(string)

Change the question of the Q&A embed component

validate(IEmbedConfigurationBase)

Validate load configuration.

Inherited Methods

exitFullscreen()

Requests the browser to exit fullscreen mode.

fullscreen()

Requests the browser to render the component's iframe in fullscreen mode.

getCorrelationId()

Get the correlationId for the current embed session.

// Get the correlationId for the current embed session
report.getCorrelationId()
  .then(correlationId => {
    ...
  });
off<T>(string, IEventHandler<T>)

Removes one or more event handlers from the list of handlers. If a reference to the existing handle function is specified, remove the specific handler. If the handler is not specified, remove all handlers for the event name specified.

report.off('pageChanged')

or

const logHandler = function (event) {
   console.log(event);
};

report.off('pageChanged', logHandler);
on<T>(string, IEventHandler<T>)

Adds an event handler for a specific event.

report.on('pageChanged', (event) => {
  console.log('PageChanged: ', event.page.name);
});
reload()

Reloads embed using existing configuration. E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state.

report.reload();
removeComponentTabIndex(number)

Removes element's tabindex attribute

save()

Saves Report.

saveAs(ISaveAsParameters)

SaveAs Report.

setAccessToken(string)

Set accessToken.

setComponentTabIndex(number)

Sets element's tabindex attribute

setComponentTitle(string)

Set the component title for accessibility. In case of iframes, this method will change the iframe title.

Method Details

configChanged(boolean)

Handle config changes.

function configChanged(_isBootstrap: boolean)

Parameters

_isBootstrap

boolean

getId()

The ID of the Q&A embed component

function getId(): string

Returns

string

setQuestion(string)

Change the question of the Q&A embed component

function setQuestion(question: string): Promise<IHttpPostMessageResponse<void>>

Parameters

question

string

question which will render Q&A data

Returns

Promise<IHttpPostMessageResponse<void>>

validate(IEmbedConfigurationBase)

Validate load configuration.

function validate(config: IEmbedConfigurationBase): IError[]

Parameters

Returns

IError[]

Inherited Method Details

exitFullscreen()

Requests the browser to exit fullscreen mode.

function exitFullscreen()

Inherited From Embed.exitFullscreen

fullscreen()

Requests the browser to render the component's iframe in fullscreen mode.

function fullscreen()

Inherited From Embed.fullscreen

getCorrelationId()

Get the correlationId for the current embed session.

// Get the correlationId for the current embed session
report.getCorrelationId()
  .then(correlationId => {
    ...
  });
function getCorrelationId(): Promise<string>

Returns

Promise<string>

Inherited From Embed.getCorrelationId

off<T>(string, IEventHandler<T>)

Removes one or more event handlers from the list of handlers. If a reference to the existing handle function is specified, remove the specific handler. If the handler is not specified, remove all handlers for the event name specified.

report.off('pageChanged')

or

const logHandler = function (event) {
   console.log(event);
};

report.off('pageChanged', logHandler);
function off<T>(eventName: string, handler?: IEventHandler<T>)

Parameters

eventName

string

handler

IEventHandler<T>

Inherited From Embed.off

on<T>(string, IEventHandler<T>)

Adds an event handler for a specific event.

report.on('pageChanged', (event) => {
  console.log('PageChanged: ', event.page.name);
});
function on<T>(eventName: string, handler: IEventHandler<T>)

Parameters

eventName

string

handler

IEventHandler<T>

Inherited From Embed.on

reload()

Reloads embed using existing configuration. E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state.

report.reload();
function reload(): Promise<void>

Returns

Promise<void>

Inherited From Embed.reload

removeComponentTabIndex(number)

Removes element's tabindex attribute

function removeComponentTabIndex(_tabIndex?: number)

Parameters

_tabIndex

number

Inherited From Embed.removeComponentTabIndex

save()

Saves Report.

function save(): Promise<void>

Returns

Promise<void>

Inherited From Embed.save

saveAs(ISaveAsParameters)

SaveAs Report.

function saveAs(saveAsParameters: ISaveAsParameters): Promise<void>

Parameters

saveAsParameters
ISaveAsParameters

Returns

Promise<void>

Inherited From Embed.saveAs

setAccessToken(string)

Set accessToken.

function setAccessToken(accessToken: string): Promise<void>

Parameters

accessToken

string

Returns

Promise<void>

Inherited From Embed.setAccessToken

setComponentTabIndex(number)

Sets element's tabindex attribute

function setComponentTabIndex(tabIndex?: number)

Parameters

tabIndex

number

Inherited From Embed.setComponentTabIndex

setComponentTitle(string)

Set the component title for accessibility. In case of iframes, this method will change the iframe title.

function setComponentTitle(title: string)

Parameters

title

string

Inherited From Embed.setComponentTitle