How to use @material/data-table - 10 common examples

To help you get started, we’ve selected a few @material/data-table 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 SpringflowNL / aurelia-mdc-elements / node_modules / material-components-web / index.js View on Github external
import * as ripple from '@material/ripple/index';
import * as select from '@material/select/index';
import * as slider from '@material/slider/index';
import * as snackbar from '@material/snackbar/index';
import * as switchControl from '@material/switch/index';
import * as tabBar from '@material/tab-bar/index';
import * as tabIndicator from '@material/tab-indicator/index';
import * as tabScroller from '@material/tab-scroller/index';
import * as tab from '@material/tab/index';
import * as textField from '@material/textfield/index';
import * as topAppBar from '@material/top-app-bar/index';
// Register all components
autoInit.register('MDCCheckbox', checkbox.MDCCheckbox);
autoInit.register('MDCChip', chips.MDCChip);
autoInit.register('MDCChipSet', chips.MDCChipSet);
autoInit.register('MDCDataTable', dataTable.MDCDataTable);
autoInit.register('MDCDialog', dialog.MDCDialog);
autoInit.register('MDCDrawer', drawer.MDCDrawer);
autoInit.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel);
autoInit.register('MDCFormField', formField.MDCFormField);
autoInit.register('MDCGridList', gridList.MDCGridList);
autoInit.register('MDCIconButtonToggle', iconButton.MDCIconButtonToggle);
autoInit.register('MDCLineRipple', lineRipple.MDCLineRipple);
autoInit.register('MDCLinearProgress', linearProgress.MDCLinearProgress);
autoInit.register('MDCList', list.MDCList);
autoInit.register('MDCMenu', menu.MDCMenu);
autoInit.register('MDCMenuSurface', menuSurface.MDCMenuSurface);
autoInit.register('MDCNotchedOutline', notchedOutline.MDCNotchedOutline);
autoInit.register('MDCRadio', radio.MDCRadio);
autoInit.register('MDCRipple', ripple.MDCRipple);
autoInit.register('MDCSelect', select.MDCSelect);
autoInit.register('MDCSlider', slider.MDCSlider);
github material-components / material-components-web / packages / material-components-web / index.ts View on Github external
import * as select from '@material/select/index';
import * as slider from '@material/slider/index';
import * as snackbar from '@material/snackbar/index';
import * as switchControl from '@material/switch/index';
import * as tabBar from '@material/tab-bar/index';
import * as tabIndicator from '@material/tab-indicator/index';
import * as tabScroller from '@material/tab-scroller/index';
import * as tab from '@material/tab/index';
import * as textField from '@material/textfield/index';
import * as topAppBar from '@material/top-app-bar/index';

// Register all components
autoInit.register('MDCCheckbox', checkbox.MDCCheckbox);
autoInit.register('MDCChip', chips.MDCChip);
autoInit.register('MDCChipSet', chips.MDCChipSet);
autoInit.register('MDCDataTable', dataTable.MDCDataTable);
autoInit.register('MDCDialog', dialog.MDCDialog);
autoInit.register('MDCDrawer', drawer.MDCDrawer);
autoInit.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel);
autoInit.register('MDCFormField', formField.MDCFormField);
autoInit.register('MDCGridList', gridList.MDCGridList);
autoInit.register('MDCIconButtonToggle', iconButton.MDCIconButtonToggle);
autoInit.register('MDCLineRipple', lineRipple.MDCLineRipple);
autoInit.register('MDCLinearProgress', linearProgress.MDCLinearProgress);
autoInit.register('MDCList', list.MDCList);
autoInit.register('MDCMenu', menu.MDCMenu);
autoInit.register('MDCMenuSurface', menuSurface.MDCMenuSurface);
autoInit.register('MDCNotchedOutline', notchedOutline.MDCNotchedOutline);
autoInit.register('MDCRadio', radio.MDCRadio);
autoInit.register('MDCRipple', ripple.MDCRipple);
autoInit.register('MDCSelect', select.MDCSelect);
autoInit.register('MDCSlider', slider.MDCSlider);
github trimox / angular-mdc-web / packages / data-table / data-table.ts View on Github external
}),
      notifySelectedAll: () => this.selectedAll.emit(),
      notifyUnselectedAll: () => this.unselectedAll.emit(),
      registerHeaderRowCheckbox: () => this._registerHeaderCheckbox(),
      registerRowCheckboxes: () => this._registerRowCheckboxes(),
      removeClassAtRowIndex: (rowIndex: number, className: string) =>
        this.getRows()[rowIndex].getNativeElement().classList.remove(className),
      setAttributeAtRowIndex: (rowIndex: number, attr: string, value: string) =>
        this.getRows()[rowIndex].getNativeElement().setAttribute(attr, value),
      setHeaderRowCheckboxChecked: (checked: boolean) => this._headerCheckbox!.checked = checked,
      setHeaderRowCheckboxIndeterminate: (indeterminate: boolean) =>
        this._headerCheckbox!.indeterminate = indeterminate,
      setRowCheckboxCheckedAtIndex: (rowIndex: number, checked: boolean) =>
        this.getRows()[rowIndex]._checkbox ? this.getRows()[rowIndex]._checkbox!.toggle(checked) : null
    };
    return new MDCDataTableFoundation(adapter);
  }
github pgbross / vue-material-adapter / packages / mcwv-data-table / data-table.js View on Github external
},
      setAttributeAtRowIndex: (rowIndex, attr, value) => {
        this.getRows()[rowIndex].setAttribute(attr, value);
      },
      setHeaderRowCheckboxChecked: checked => {
        this.headerRowCheckbox_.checked = checked;
      },
      setHeaderRowCheckboxIndeterminate: indeterminate => {
        this.headerRowCheckbox_.indeterminate = indeterminate;
      },
      setRowCheckboxCheckedAtIndex: (rowIndex, checked) => {
        this.rowCheckboxList_[rowIndex].checked = checked;
      },
    };

    this.foundation = new MDCDataTableFoundation(adapter);
    this.foundation.init();

    this.headerRow_ = this.$el.querySelector(`.${cssClasses.HEADER_ROW}`);
    this.handleHeaderRowCheckboxChange_ = () =>
      this.foundation.handleHeaderRowCheckboxChange();
    this.headerRow_.addEventListener(
      'change',
      this.handleHeaderRowCheckboxChange_,
    );

    this.content_ = this.$el.querySelector(`.${cssClasses.CONTENT}`);
    this.handleRowCheckboxChange_ = event =>
      this.foundation.handleRowCheckboxChange(event);
    this.content_.addEventListener('change', this.handleRowCheckboxChange_);

    this.layout();
github trimox / angular-mdc-web / packages / data-table / data-table.ts View on Github external
        this.getRows().findIndex(_ => _.getNativeElement() === ((closest(el, strings.ROW_SELECTOR) as HTMLElement))),
      getSelectedRowCount: () => this.elementRef.nativeElement.querySelectorAll(strings.ROW_SELECTED_SELECTOR).length,
github trimox / angular-mdc-web / packages / data-table / data-table.ts View on Github external
      getRowElements: () => [].slice.call(this.elementRef.nativeElement.querySelectorAll(strings.ROW_SELECTOR)),
      getRowIdAtIndex: (rowIndex: number) =>
github material-components / material-components-web-catalog / src / DataTableCatalog.js View on Github external
const Cell = (props) => {
  const classes = classNames(cssClasses.CELL, {
    [cssClasses.CELL_NUMERIC]: props.isNumeric,
  }, props.classes);
  const { id } = props;

  return (
    {props.children}
  );
};
github material-components / material-components-web-catalog / src / DataTableCatalog.js View on Github external
const Cell = (props) => {
  const classes = classNames(cssClasses.CELL, {
    [cssClasses.CELL_NUMERIC]: props.isNumeric,
  }, props.classes);
  const { id } = props;

  return (
    {props.children}
  );
};
github material-components / material-components-web-catalog / src / DataTableCatalog.js View on Github external
const dataTable = React.createRef();

  useEffect(() => {
    MDCDataTable.attachTo(dataTable.current);
  });

  return (
    <div>
      
            {props.rowSelection ?  : null}
            {props.data.headers.map((header, index) =&gt; {header})}
          
                {props.rowSelection ?  : null}
                {row.map((content, index) =&gt; {
                  let id = index === 0 ? rowId : null;
                  return {content};
                })}
              <table>
        <thead>
          <tr></tr>
        </thead>
        <tbody></tbody></table>
          {props.data.rows.map((row, index) =&gt; {
            const isSelected = props.rowSelection ? props.data.selectedRowIndexes.indexOf(index) &gt;= 0 : false;
            const rowId = `u${idIncrement++}`;
            return (
              
            );
          })}
        </div>