Closed sveri closed 9 years ago
You commented out the closing }
of your attribute map ;)
Try:
[:td [:div {:draggable true
:ondragstart (fn [e] (println "foo"))
;:ondragstart drag-start
}
col]])]]
This is just a copy and paster error. Sorry for confusing things. The code compiles fine on my side and paredit shows no errors neither.
Okay, also the event handler should be :on-dragstart
. Event handlers should always be prefixed with :on-
and then have the exact name of the DOM event.
Setting :ondragstart
will set a DOM attribute (which will be parsed as javascript - thus the syntax error), not add an event listener.
Thank you, it works with :on-dragstart. I am pretty sure I tried that before, however, it seems like some weird state was left in the browser, making it not work. Thank you very much :-)
You're welcome!
@sveri @aaronc It'd be really great if things like this would end up in an example dir in the project. I tried reactive a few days back and had a really hard time because it's been hard to find any code to look at to figure out how to do stuff :)
Hi Martin, I'd really love to have some more example projects - ideally ultimately there will be a step-by-step tutorial... My bandwidth is pretty full for the next couple weeks and my first priority for freactive is making sure all the essential features are implemented, debugged & documented. So, if anybody else wants to post any examples they got working - maybe some gists, that'd be great... Maybe early 2015, I can work on some sort of tutorial.
Hi,
I am trying to get drag and drop working with freactive, but have no success so far. This is the code:
While draggable true works, as I can start dragging the div, the ondragstart throws this exception: Uncaught SyntaxError: Unexpected token ( here: <!DOCTYPE html>
Calling a predefined function like this: ondragstart drag-start} Just does nothing.
I can provide more information if needed.