триггер "показывать данные" извне iframe - PullRequest
0 голосов
/ 07 ноября 2018

Я встраиваю отчеты PowerBi в угловое веб-приложение 7, мы используем Powerbi-Client для связи с фреймом и PowerBi. Мне нужны две вещи:

  1. Как скрыть контекстное меню или запретить использование контекстного меню при щелчке правой кнопкой мыши по отчету.
  2. Как я могу активировать опцию «Показать данные» из-за пределов IFrame.

Спасибо

1 Ответ

0 голосов
/ 08 ноября 2018

Для показа данных вы можете использовать данные экспорта:

// Get models. models contains enums that can be used.
var models = window['powerbi-client'].models;

// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];

// Get a reference to the embedded report.
report = powerbi.get(embedContainer);

// Retrieve the page collection and get the visuals for the first page.
report.getPages()
  .then(function (pages) {

    // Retrieve active page.
    var activePage = pages.find(function(page) {
      return page.isActive
    });

    activePage.getVisuals()
      .then(function (visuals) {

        // Retrieve the wanted visual.
        var visual = visuals.find(function(visual) {
          return visual.name == "VisualContainer4";
        });

        // Exports visual data
        visual.exportData(models.ExportDataType.Summarized)
          .then(function (result) {
            Log.logCsv(result.data);
          })
          .catch(function (errors) {
            Log.log(errors);
          });
        })
        .catch(function (errors) {
          Log.log(errors);
        });
  })
  .catch(function (errors) {
    Log.log(errors);
  });
            .catch(errors => {
                console.log(errors.message);
            });

В log.logCsv (result.data) вы можете манипулировать данными, чтобы делать все, что вы хотите, за пределами фрейма pbi.

...