mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
Orderable Resource not a requirement for table anymore
This commit is contained in:
parent
620506b17c
commit
b5f0180cd6
BIN
js/.DS_Store
vendored
Normal file
BIN
js/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
js/components/.DS_Store
vendored
Normal file
BIN
js/components/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
js/components/ascribe_table/.DS_Store
vendored
Normal file
BIN
js/components/ascribe_table/.DS_Store
vendored
Normal file
Binary file not shown.
@ -12,9 +12,9 @@ let TableHeader = React.createClass({
|
|||||||
propTypes: {
|
propTypes: {
|
||||||
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
|
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
|
||||||
itemList: React.PropTypes.array.isRequired,
|
itemList: React.PropTypes.array.isRequired,
|
||||||
changeOrder: React.PropTypes.func.isRequired,
|
changeOrder: React.PropTypes.func,
|
||||||
orderAsc: React.PropTypes.bool.isRequired,
|
orderAsc: React.PropTypes.bool,
|
||||||
orderBy: React.PropTypes.string.isRequired
|
orderBy: React.PropTypes.string
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -8,10 +8,10 @@ let TableHeaderItem = React.createClass({
|
|||||||
columnClasses: React.PropTypes.string.isRequired,
|
columnClasses: React.PropTypes.string.isRequired,
|
||||||
displayName: React.PropTypes.string.isRequired,
|
displayName: React.PropTypes.string.isRequired,
|
||||||
columnName: React.PropTypes.string.isRequired,
|
columnName: React.PropTypes.string.isRequired,
|
||||||
canBeOrdered: React.PropTypes.bool.isRequired,
|
canBeOrdered: React.PropTypes.bool,
|
||||||
changeOrder: React.PropTypes.func.isRequired,
|
changeOrder: React.PropTypes.func,
|
||||||
orderAsc: React.PropTypes.bool.isRequired,
|
orderAsc: React.PropTypes.bool,
|
||||||
orderBy: React.PropTypes.string.isRequired
|
orderBy: React.PropTypes.string
|
||||||
},
|
},
|
||||||
|
|
||||||
changeOrder() {
|
changeOrder() {
|
||||||
@ -19,7 +19,7 @@ let TableHeaderItem = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
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) {
|
if(this.props.columnName === this.props.orderBy) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import TableColumnContentModel from '../../models/table_column_content_model';
|
import TableColumnContentModel from '../../models/table_column_content_model';
|
||||||
|
import TableColumnMixin from '../../mixins/table_column_mixin';
|
||||||
|
|
||||||
import EditionListStore from '../../stores/edition_list_store';
|
import EditionListStore from '../../stores/edition_list_store';
|
||||||
import EditionListActions from '../../actions/edition_list_actions';
|
import EditionListActions from '../../actions/edition_list_actions';
|
||||||
@ -15,6 +16,7 @@ import TableItemSubtableButton from './table_item_subtable_button';
|
|||||||
|
|
||||||
|
|
||||||
let TableItemSubtable = React.createClass({
|
let TableItemSubtable = React.createClass({
|
||||||
|
mixins: [TableColumnMixin],
|
||||||
propTypes: {
|
propTypes: {
|
||||||
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
|
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
|
||||||
columnContent: React.PropTypes.object
|
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() {
|
render() {
|
||||||
|
|
||||||
let calcColumnElementContent = () => {
|
let calcColumnElementContent = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user