It would be helpful if you could give us your code to look at.  That may
make it easier to explain what you want to achieve as well.

But if I understand what you want (which may not be the case), you could
do something like this:

Assuming a data structure like so,

[{:type :item :pos 1} {:type :sep :pos 2} ... ]

you could choose a component on a case-by-case basis:

(map
  #(case (:type %)
    :item (om/build item-comp %)
    :sep  (om/build sep-comp %))
(sort-by :pos collection-of-items-or-separators))

...for example.

(2014/06/26 23:47), [email protected] wrote:
> Hi,
> 
> I'm using swanodettes om for my web app. I have a list of items which will be 
> draggable to sort the list. Based on a specific value of the items I compute 
> some separators, which are then added to the list.
> The separators use a different template, because they show other information 
> than the items.
> 
> What I want to do is: 
> 1) Changing the order of the items (due to dragging or changing the value the 
> list is sorted by)
> 2) Recompute the position of the separators
> 
> Reordering and rendering works fine, if all items use the same html-template 
> as in swanodettes example. In my case, when the position of a separator 
> changes, only the separator itself and the item it changed positions with, 
> are rerendered. Or at least the render-functions are called. The html isn't 
> updated appropriately.
> That is, the html of the separator remains at the same position as before and 
> om tries to apply the values of the items to it. Which doesn't work since 
> there are other fields.
> Hope someone understands the problem.
> 
> An example:
> The cursor contains the list: item1, item2, sep1, item3 sep2, item4
> The rendered list shows: item1, item2, sep1, item3, sep2, item4
> 
> Then a value changes and the separators get new positions
> The cursor: item1, sep1, item2, item3, sep2, item4
> The rendered list: item1, item2, sep1, item3, sep2, item4
> 
> What happens is that item2 and sep1 are 'rerendered' in the sense of the 
> render(-state) functions are called. But the graphical items at these 
> positions remain the same while being applied the new values.
> 
> Did I make clear, what the problem is? Otherwise please let me know and I 
> will try again.
> 
> Any ideas on how to remove the separators from the list and add them add new 
> positions?
> 

-- 
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.

Reply via email to