How to use the @jupyterlab/csvviewer.DSVModel function in @jupyterlab/csvviewer

To help you get started, we’ve selected a few @jupyterlab/csvviewer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / tests / test-csvviewer / src / model.spec.ts View on Github external
it('handles delayed parsing of rows past the initial rows', async () => {
      const d = new DSVModel({
        data: `a,b,c\nc,d,e\nf,g,h\ni,j,k`,
        delimiter: ',',
        initialRows: 2
      });
      expect(d.rowCount('column-header')).to.equal(1);
      expect(d.rowCount('body')).to.equal(1);
      expect(d.columnCount('row-header')).to.equal(1);
      expect(d.columnCount('body')).to.equal(3);
      expect([0, 1, 2].map(i => d.data('column-header', 0, i))).to.deep.equal([
        'a',
        'b',
        'c'
      ]);

      // Expected behavior is that all unparsed data is lumped into the final field.
      expect([0, 1, 2].map(i => d.data('body', 0, i))).to.deep.equal([
github jupyterlab / jupyterlab / tests / test-csvviewer / src / model.spec.ts View on Github external
it('handles having only a header', () => {
      const d = new DSVModel({ data: 'a,b,c\n', delimiter: ',', header: true });
      expect(d.rowCount('column-header')).to.equal(1);
      expect(d.rowCount('body')).to.equal(0);
      expect(d.columnCount('row-header')).to.equal(1);
      expect(d.columnCount('body')).to.equal(3);
      expect([0, 1, 2].map(i => d.data('column-header', 0, i))).to.deep.equal([
        'a',
        'b',
        'c'
      ]);
    });
github jupyterlab / jupyterlab-data-explorer / dataregistry-extension / src / csvviewer.ts View on Github external
this._subscription = this._data.subscribe(data => {
      if (this.model) {
        (this.model as DSVModel).dispose();
      }
      this.model = new DSVModel({ data, delimiter: "," });
    });
    super.onBeforeAttach(msg);
github jupyterlab / jupyterlab-data-explorer / packages / dataregistry-csvviewer-extension / src / data_grid.ts View on Github external
function onData(data: string) {
      if (self.model) {
        (self.model as DSVModel).dispose();
      }
      self.model = new DSVModel({
        data: data,
        delimiter: ','
      });
    }
  }