From d71e6baa19a5f3ec95ee2c4530b6e2a141cfe053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 26 May 2015 17:25:03 +0200 Subject: [PATCH] add persistent selected rows --- js/components/ascribe_table/table_item_subtable.js | 1 + js/stores/edition_list_store.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/js/components/ascribe_table/table_item_subtable.js b/js/components/ascribe_table/table_item_subtable.js index 66faee49..f3d65407 100644 --- a/js/components/ascribe_table/table_item_subtable.js +++ b/js/components/ascribe_table/table_item_subtable.js @@ -42,6 +42,7 @@ let TableItemSubtable = React.createClass({ 'open': false }); } else { + EditionListActions.fetchEditionList(this.props.columnContent.id); this.setState({ 'open': true, diff --git a/js/stores/edition_list_store.js b/js/stores/edition_list_store.js index 0edad1dc..feb0ba2a 100644 --- a/js/stores/edition_list_store.js +++ b/js/stores/edition_list_store.js @@ -1,3 +1,5 @@ +import React from 'react'; + import alt from '../alt'; import EditionsListActions from '../actions/edition_list_actions'; @@ -8,6 +10,13 @@ class EditionListStore { } onUpdateEditionList({pieceId, editionListOfPiece}) { + if(this.editionList[pieceId]) { + this.editionList[pieceId].forEach((edition, i) => { + // This uses the index of the new editionList for determining the edition. + // If the list of editions can be sorted in the future, this needs to be changed! + editionListOfPiece[i] = React.addons.update(edition, {$merge: editionListOfPiece[i]}); + }) + } this.editionList[pieceId] = editionListOfPiece; }