You got me thinking : if we're storing drop-index,  why not just use it during 
the build phase as follows : 

(apply dom/ul #js {:className "sortable" :ref "sortable"}
    (flatten (map-indexed
                                      (fn [idx item]
                                         [(when (= idx (:drop-index state))
                                            (sortable-spacer (second 
(:cell-dimensions state))))
                                          (om/build line-item item {:opts opts 
:key :id} )
                                          ]) 
                                        init-list ))))))

Which gives us the spacer item in the right place without "adulterating" the 
list with it. Not sure if flatten here will perform any better than the 
insert-at function, but I'm not quite sure if there's a better way to achieve 
this sort of thing. 

On Friday, February 7, 2014 4:37:24 PM UTC-8, David Pidcock wrote:
> Hmm, really?  How would you do it differently? 
> Seems like the perseus orderer uses the same technique  (slicing out the card 
> you're about to drag, and inserting a placeholder at that index instead)
> 
> On Friday, February 7, 2014 10:25:41 AM UTC-8, David Nolen wrote:
> > Without a minimal case it's hard for me to understand what the problem is. 
> > I will say the spacer technique in my sorting example was a simple hack and 
> > not the way I would do a sortable - I suspect it may be the source of some 
> > of these issues.
> > 
> > 
> >

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