WiP on segments

This commit is contained in:
Tomas Bures 2017-08-19 15:12:22 +02:00
parent 6cc34136f5
commit f3ff89c536
21 changed files with 945 additions and 352 deletions

View file

@ -15,6 +15,7 @@ import axios from './axios';
import { withPageHelpers } from '../lib/page'
import { withErrorHandling, withAsyncErrorHandler } from './error-handling';
import styles from "./styles.scss";
//dtFactory();
//dtSelectFactory();
@ -169,7 +170,7 @@ class Table extends Component {
this.selectionMap = nextSelectionMap;
return updateDueToSelectionChange || this.props.data != nextProps.data || this.props.dataUrl != nextProps.dataUrl;
return updateDueToSelectionChange || this.props.data !== nextProps.data || this.props.dataUrl !== nextProps.dataUrl;
}
componentDidMount() {
@ -179,7 +180,7 @@ class Table extends Component {
for (const column of columns) {
if (column.actions) {
const createdCellFn = (td, data, rowData) => {
const linksContainer = jQuery('<span class="mt-action-links"/>');
const linksContainer = jQuery(`<span class="${styles.actionLinks}"/>`);
let actions = column.actions(rowData);
let options = {};
@ -322,19 +323,20 @@ class Table extends Component {
if (this.props.data) {
this.table.clear();
this.table.rows.add(this.props.data);
} else {
const self = this;
this.table.rows().every(function() {
const key = this.data()[self.props.selectionKeyIndex];
if (self.selectionMap.has(key)) {
jQuery(this.node()).addClass('selected');
} else {
jQuery(this.node()).removeClass('selected');
}
});
this.refresh();
}
const self = this;
this.table.rows().every(function() {
const key = this.data()[self.props.selectionKeyIndex];
if (self.selectionMap.has(key)) {
jQuery(this.node()).addClass('selected');
} else {
jQuery(this.node()).removeClass('selected');
}
});
this.updateSelectInfo();
this.fetchAndNotifySelectionData();
}