Zugriff auf "this" reagiert, wenn einem Ereignis eine Methode zugewiesen wird

Apologize im Voraus, ich bin sehr neu zu reagieren.

ImprintDocument Ich stelle das @ eoHiddFrame.onload = this.setPrint; sogar zuthis.setPrint bekomme aber einen Fehler vonCannot set property '__container__' of undefined zumthis imsetPrint bei der ersten Aufgabe.

Ich setzeonClick={this.printDocument.bind(null, this.props.document.view_href)} on button in render (). Wie binde ich "dies" an das tatsächliche Ereignis, dem ich es zuordnete?

ielen Dank für jede Hilfe oder Beratun

  closePrint: function () {
    document.body.removeChild(this.oHiddFrame.__container__);
  },

  setPrint: function () {
    this.contentWindow.__container__ = this;
    this.contentWindow.onbeforeunload = this.closePrint;
    this.contentWindow.onafterprint = this.closePrint;
    this.contentWindow.focus();
    this.contentWindow.print();
  },

  printDocument: function (url) {
    var oHiddFrame = document.createElement("iframe");
    oHiddFrame.onload = this.setPrint;
    oHiddFrame.style.visibility = "hidden";
    oHiddFrame.style.position = "fixed";
    oHiddFrame.style.right = "0";
    oHiddFrame.style.bottom = "0";
    oHiddFrame.src = url;
    document.body.appendChild(oHiddFrame);
  },

Antworten auf die Frage(6)

Ihre Antwort auf die Frage