瀏覽代碼

Expose CSV widget context.

Afshin Darian 8 年之前
父節點
當前提交
c363b2e8af
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      src/csvwidget/widget.ts

+ 9 - 1
src/csvwidget/widget.ts

@@ -52,7 +52,7 @@ class CSVWidget extends Widget {
   constructor(options: CSVWidget.IOptions) {
     super();
 
-    let context = options.context;
+    let context = this._context = options.context;
     let layout = this.layout = new PanelLayout();
 
     this.addClass(CSV_CLASS);
@@ -88,6 +88,13 @@ class CSVWidget extends Widget {
     }, this);
   }
 
+  /**
+   * The CSV widget's context.
+   */
+  get context(): DocumentRegistry.IContext<DocumentRegistry.IModel> {
+    return this._context;
+  }
+
   /**
    * The CSV data model.
    */
@@ -126,6 +133,7 @@ class CSVWidget extends Widget {
     this.node.focus();
   }
 
+  private _context: DocumentRegistry.IContext<DocumentRegistry.IModel> = null;
   private _model: CSVModel = null;
   private _table: CSVTable = null;
   private _toolbar: CSVToolbar = null;