1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Orderable Resource not a requirement for table anymore

This commit is contained in:
Tim Daubenschütz 2015-05-26 14:05:34 +02:00
parent 620506b17c
commit b5f0180cd6
7 changed files with 10 additions and 21 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
js/.DS_Store vendored Normal file

Binary file not shown.

BIN
js/components/.DS_Store vendored Normal file

Binary file not shown.

BIN
js/components/ascribe_table/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -12,9 +12,9 @@ let TableHeader = React.createClass({
propTypes: {
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
itemList: React.PropTypes.array.isRequired,
changeOrder: React.PropTypes.func.isRequired,
orderAsc: React.PropTypes.bool.isRequired,
orderBy: React.PropTypes.string.isRequired
changeOrder: React.PropTypes.func,
orderAsc: React.PropTypes.bool,
orderBy: React.PropTypes.string
},
render() {

View File

@ -8,10 +8,10 @@ let TableHeaderItem = React.createClass({
columnClasses: React.PropTypes.string.isRequired,
displayName: React.PropTypes.string.isRequired,
columnName: React.PropTypes.string.isRequired,
canBeOrdered: React.PropTypes.bool.isRequired,
changeOrder: React.PropTypes.func.isRequired,
orderAsc: React.PropTypes.bool.isRequired,
orderBy: React.PropTypes.string.isRequired
canBeOrdered: React.PropTypes.bool,
changeOrder: React.PropTypes.func,
orderAsc: React.PropTypes.bool,
orderBy: React.PropTypes.string
},
changeOrder() {
@ -19,7 +19,7 @@ let TableHeaderItem = React.createClass({
},
render() {
if(this.props.canBeOrdered) {
if(this.props.canBeOrdered && this.props.changeOrder && this.props.orderAsc != null && this.props.orderBy) {
if(this.props.columnName === this.props.orderBy) {
return (
<div

View File

@ -1,6 +1,7 @@
import React from 'react';
import TableColumnContentModel from '../../models/table_column_content_model';
import TableColumnMixin from '../../mixins/table_column_mixin';
import EditionListStore from '../../stores/edition_list_store';
import EditionListActions from '../../actions/edition_list_actions';
@ -15,6 +16,7 @@ import TableItemSubtableButton from './table_item_subtable_button';
let TableItemSubtable = React.createClass({
mixins: [TableColumnMixin],
propTypes: {
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
columnContent: React.PropTypes.object
@ -48,19 +50,6 @@ let TableItemSubtable = React.createClass({
}
},
calcColumnClasses(list, i) {
let bootstrapClasses = ['col-xs-', 'col-sm-', 'col-md-', 'col-lg-'];
let listOfRowValues = list.map((column) => column.rowWidth );
let numOfColumns = GeneralUtils.sumNumList(listOfRowValues);
if(numOfColumns > 10) {
throw new Error('Bootstrap has only 12 columns to assign. You defined ' + numOfColumns + '. Change this in the columnMap you\'re passing to the table.')
} else {
return bootstrapClasses.join( listOfRowValues[i] + ' ') + listOfRowValues[i];
}
},
render() {
let calcColumnElementContent = () => {