Before I start posting code, I want to describe my logic to make sure I'm on
the right path.
I show a table scheduling lectures. Each row (reagent component) has a date, a
department, a speaker, and a topic. Each of these (except date) is a dropdown,
whose list of possible values is dependent on the select before it. Department
determines possible speakers, and speaker determines possible topics.
At the end of each row is a bootstrap button which populates a ratom with the
state of the current row, then shows a modal. That modal should allow each of
those 3 selects to be changed, and update the dependent lists with possible
selections. It's state is determined by the ratom populated from the table row.
The issue I am having is the currently selected item when moving from one row
to another. So if I edit a row, change the select values, close the dialog,
then edit a different row, one of the select components is still showing values
from the previous row.
Example:
Row 1: 1/1/2014 Department A Speaker 1 Topic Foo
Row 2: 2/1/2014 Department B Speaker 2 Topic Bar
After using the modal to change a value in row 1, the doing the same in row 2,
the 'speaker' selection reflects the one from row 1, not row 2.
Here's some code:
(reset! selected-item-out selected-item-in)
[:select {:id id
:value @selected-item-out
:on-change #(update-select-component-state selected-item-out %
modal-map-atom map-of-maps k)}
Here's what doesn't make sense:
When I output the value of @selected-item-out, it reflects what the select
component *should* display as the selected value after it is updated from
selected-item-in. Yet the select shows the previous value when it is rendered.
According to the HTML5 spec, IIRC, setting 'value' on a select UI item is
preferred to the 'selected' property on an option.
Is there a better way to (a) update the currently selected item in the list or
(b) delete and replace the entire component to force the correct selection to
appear?
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.