How to use @lumino/datagrid - 10 common examples

To help you get started, we’ve selected a few @lumino/datagrid 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 / widget.spec.ts View on Github external
function createGridSearchService(model: JSONModel): GridSearchService {
      const grid = new DataGrid();
      grid.dataModel = model;
      return new GridSearchService(grid);
    }
github jupyterlab / jupyterlab / tests / test-csvviewer / src / widget.spec.ts View on Github external
function createModel(): JSONModel {
      return new JSONModel({
        data: [
          { index: 0, a: 'other', b: 'match 1' },
          { index: 1, a: 'other', b: 'match 2' }
        ],
        schema: {
          primaryKey: ['index'],
          fields: [
            {
              name: 'a'
            },
            { name: 'b' }
          ]
        }
      });
    }
    function createGridSearchService(model: JSONModel): GridSearchService {
github jupyterlab / lumino / examples / example-datagrid / src / index.ts View on Github external
let fgColorFloatRenderer = new TextRenderer({
    font: 'bold 12px sans-serif',
    textColor: redGreenBlack,
    format: TextRenderer.formatFixed({ digits: 2 }),
    horizontalAlignment: 'right'
  });

  let bgColorFloatRenderer = new TextRenderer({
    textColor: heatMapViridisInverse,
    backgroundColor: heatMapViridis,
    format: TextRenderer.formatFixed({ digits: 2 }),
    horizontalAlignment: 'right'
  });

  let grid1 = new DataGrid({ style: blueStripeStyle });
  grid1.dataModel = model1;
  grid1.keyHandler = new BasicKeyHandler();
  grid1.mouseHandler = new BasicMouseHandler();
  grid1.selectionModel = new BasicSelectionModel({ dataModel: model1 });

  let grid2 = new DataGrid({ style: brownStripeStyle });
  grid2.dataModel = model2;
  grid2.keyHandler = new BasicKeyHandler();
  grid2.mouseHandler = new BasicMouseHandler();
  grid2.selectionModel = new BasicSelectionModel({
    dataModel: model2,
    selectionMode: 'column'
  });

  let grid3 = new DataGrid({ stretchLastColumn: true });
  grid3.cellRenderers.update({ 'body': fgColorFloatRenderer });
github jupyterlab / lumino / examples / example-datagrid / src / index.ts View on Github external
grid2.dataModel = model2;
  grid2.keyHandler = new BasicKeyHandler();
  grid2.mouseHandler = new BasicMouseHandler();
  grid2.selectionModel = new BasicSelectionModel({
    dataModel: model2,
    selectionMode: 'column'
  });

  let grid3 = new DataGrid({ stretchLastColumn: true });
  grid3.cellRenderers.update({ 'body': fgColorFloatRenderer });
  grid3.dataModel = model3;
  grid3.keyHandler = new BasicKeyHandler();
  grid3.mouseHandler = new BasicMouseHandler();
  grid3.selectionModel = new BasicSelectionModel({ dataModel: model3 });

  let grid4 = new DataGrid({ style: lightSelectionStyle });
  grid4.cellRenderers.update({ 'body': bgColorFloatRenderer });
  grid4.dataModel = model4;
  grid4.keyHandler = new BasicKeyHandler();
  grid4.mouseHandler = new BasicMouseHandler();
  grid4.selectionModel = new BasicSelectionModel({ dataModel: model4 });

  let grid5 = new DataGrid({
    style: greenStripeStyle,
    defaultSizes: {
      rowHeight: 32,
      columnWidth: 128,
      rowHeaderWidth: 64,
      columnHeaderHeight: 32
    }
  });
  grid5.dataModel = model5;
github jupyterlab / lumino / examples / example-datagrid / src / index.ts View on Github external
});

  let bgColorFloatRenderer = new TextRenderer({
    textColor: heatMapViridisInverse,
    backgroundColor: heatMapViridis,
    format: TextRenderer.formatFixed({ digits: 2 }),
    horizontalAlignment: 'right'
  });

  let grid1 = new DataGrid({ style: blueStripeStyle });
  grid1.dataModel = model1;
  grid1.keyHandler = new BasicKeyHandler();
  grid1.mouseHandler = new BasicMouseHandler();
  grid1.selectionModel = new BasicSelectionModel({ dataModel: model1 });

  let grid2 = new DataGrid({ style: brownStripeStyle });
  grid2.dataModel = model2;
  grid2.keyHandler = new BasicKeyHandler();
  grid2.mouseHandler = new BasicMouseHandler();
  grid2.selectionModel = new BasicSelectionModel({
    dataModel: model2,
    selectionMode: 'column'
  });

  let grid3 = new DataGrid({ stretchLastColumn: true });
  grid3.cellRenderers.update({ 'body': fgColorFloatRenderer });
  grid3.dataModel = model3;
  grid3.keyHandler = new BasicKeyHandler();
  grid3.mouseHandler = new BasicMouseHandler();
  grid3.selectionModel = new BasicSelectionModel({ dataModel: model3 });

  let grid4 = new DataGrid({ style: lightSelectionStyle });
github jupyterlab / lumino / examples / example-datagrid / src / index.ts View on Github external
let grid3 = new DataGrid({ stretchLastColumn: true });
  grid3.cellRenderers.update({ 'body': fgColorFloatRenderer });
  grid3.dataModel = model3;
  grid3.keyHandler = new BasicKeyHandler();
  grid3.mouseHandler = new BasicMouseHandler();
  grid3.selectionModel = new BasicSelectionModel({ dataModel: model3 });

  let grid4 = new DataGrid({ style: lightSelectionStyle });
  grid4.cellRenderers.update({ 'body': bgColorFloatRenderer });
  grid4.dataModel = model4;
  grid4.keyHandler = new BasicKeyHandler();
  grid4.mouseHandler = new BasicMouseHandler();
  grid4.selectionModel = new BasicSelectionModel({ dataModel: model4 });

  let grid5 = new DataGrid({
    style: greenStripeStyle,
    defaultSizes: {
      rowHeight: 32,
      columnWidth: 128,
      rowHeaderWidth: 64,
      columnHeaderHeight: 32
    }
  });
  grid5.dataModel = model5;
  grid5.keyHandler = new BasicKeyHandler();
  grid5.mouseHandler = new BasicMouseHandler();
  grid5.selectionModel = new BasicSelectionModel({
    dataModel: model5,
    selectionMode: 'row'
  });
github jupyterlab / lumino / examples / example-datagrid / src / index.ts View on Github external
let grid1 = new DataGrid({ style: blueStripeStyle });
  grid1.dataModel = model1;
  grid1.keyHandler = new BasicKeyHandler();
  grid1.mouseHandler = new BasicMouseHandler();
  grid1.selectionModel = new BasicSelectionModel({ dataModel: model1 });

  let grid2 = new DataGrid({ style: brownStripeStyle });
  grid2.dataModel = model2;
  grid2.keyHandler = new BasicKeyHandler();
  grid2.mouseHandler = new BasicMouseHandler();
  grid2.selectionModel = new BasicSelectionModel({
    dataModel: model2,
    selectionMode: 'column'
  });

  let grid3 = new DataGrid({ stretchLastColumn: true });
  grid3.cellRenderers.update({ 'body': fgColorFloatRenderer });
  grid3.dataModel = model3;
  grid3.keyHandler = new BasicKeyHandler();
  grid3.mouseHandler = new BasicMouseHandler();
  grid3.selectionModel = new BasicSelectionModel({ dataModel: model3 });

  let grid4 = new DataGrid({ style: lightSelectionStyle });
  grid4.cellRenderers.update({ 'body': bgColorFloatRenderer });
  grid4.dataModel = model4;
  grid4.keyHandler = new BasicKeyHandler();
  grid4.mouseHandler = new BasicMouseHandler();
  grid4.selectionModel = new BasicSelectionModel({ dataModel: model4 });

  let grid5 = new DataGrid({
    style: greenStripeStyle,
    defaultSizes: {
github jupyterlab / lumino / examples / example-datagrid / src / index.ts View on Github external
format: TextRenderer.formatFixed({ digits: 2 }),
    horizontalAlignment: 'right'
  });

  let bgColorFloatRenderer = new TextRenderer({
    textColor: heatMapViridisInverse,
    backgroundColor: heatMapViridis,
    format: TextRenderer.formatFixed({ digits: 2 }),
    horizontalAlignment: 'right'
  });

  let grid1 = new DataGrid({ style: blueStripeStyle });
  grid1.dataModel = model1;
  grid1.keyHandler = new BasicKeyHandler();
  grid1.mouseHandler = new BasicMouseHandler();
  grid1.selectionModel = new BasicSelectionModel({ dataModel: model1 });

  let grid2 = new DataGrid({ style: brownStripeStyle });
  grid2.dataModel = model2;
  grid2.keyHandler = new BasicKeyHandler();
  grid2.mouseHandler = new BasicMouseHandler();
  grid2.selectionModel = new BasicSelectionModel({
    dataModel: model2,
    selectionMode: 'column'
  });

  let grid3 = new DataGrid({ stretchLastColumn: true });
  grid3.cellRenderers.update({ 'body': fgColorFloatRenderer });
  grid3.dataModel = model3;
  grid3.keyHandler = new BasicKeyHandler();
  grid3.mouseHandler = new BasicMouseHandler();
  grid3.selectionModel = new BasicSelectionModel({ dataModel: model3 });