dragstart interferes with click events on the same element

20 views
Skip to first unread message

Lee Henson

unread,
Dec 17, 2008, 12:21:16 PM12/17/08
to JavaScript MVC
I have a table with a column on which I am using the jQuery plugin
"jeditable" to add simple inline editing. It works by receiving a
double-click event, and then replacing the normal contents of the cell
with a text input. When the user triggers a blur event by tab-ing off
the input or clicking somewhere else on the screen, the input is
hidden and the cell contents refreshed with the input contents.

Also on this table I am using jmvc drag/drop, to support reordering of
rows. However, when I add a 'dragstart' event handler, the onblur
functionality of jeditable is disabled. I've tracked it down to the
mousedown function in drag.js, specifically the line which calls
params.event.prevent_default(). When I comment it out jeditable works
normally, but dragging causes text elements to be highlighted under
the cursor. I am guessing that is the reason prevent_default() is
there?

Is there an alternative way of preventing drag highlighting - I know
you can do stuff like onselectstart/MozUserSelect/KhtmlUserSelect but
that's all a bit a pain compared with prevent_default(). Any other
ideas?

Victor Kornov

unread,
Dec 17, 2008, 12:28:04 PM12/17/08
to javasc...@googlegroups.com
Ugly: manually route event to jeditable. A callback which gets called instead of always doing prevent_default().

Justin Meyer

unread,
Dec 17, 2008, 1:44:30 PM12/17/08
to javasc...@googlegroups.com
I'm not sure if I am saying the same thing, but is it possible to have drag start call the blur function?

If those other options can work cross browser, that's even better ... but I think this is something to think about for 2.0.  I'm not sure if you noticed, there is a 1.5 branch everyone is updating from now.

--
Justin Meyer

Jupiter IT Solutions
847-924-6039
justin...@gmail.com
AOL: jusbarmey

Lee Henson

unread,
Dec 17, 2008, 1:58:19 PM12/17/08
to JavaScript MVC
Check:

http://github.com/leemhenson/javascriptmvc/commit/30c90b02f8193388dc2e703ec43a7eef383bd991

Works on FF, Safari. Not sure about IE because I've other IE issues
preventing me using that part of my page at the moment.

On Dec 17, 6:44 pm, "Justin Meyer" <justinbme...@gmail.com> wrote:
> I'm not sure if I am saying the same thing, but is it possible to have drag
> start call the blur function?
> If those other options can work cross browser, that's even better ... but I
> think this is something to think about for 2.0.  I'm not sure if you
> noticed, there is a 1.5 branch everyone is updating from now.
>
>
>
> On Wed, Dec 17, 2008 at 11:28 AM, Victor Kornov <wee...@gmail.com> wrote:
> > Ugly: manually route event to jeditable. A callback which gets called
> > instead of always doing prevent_default().
>
> > On Wed, Dec 17, 2008 at 8:21 PM, Lee Henson <lee.m.hen...@gmail.com>wrote:
>
> >> Is there an alternative way of preventing drag highlighting - I know
> >> you can do stuff like onselectstart/MozUserSelect/KhtmlUserSelect but
> >> that's all a bit a pain compared with prevent_default(). Any other
> >> ideas?
>
> --
> Justin Meyer
>
> Jupiter IT Solutions
> 847-924-6039
> justinbme...@gmail.com
> AOL: jusbarmey

Lee Henson

unread,
Dec 18, 2008, 6:10:09 AM12/18/08
to JavaScript MVC
Patch available here:

http://code.google.com/p/javascriptmvc/issues/detail?id=38

*Seems* to be working cross-browser.

On Dec 17, 6:58 pm, Lee Henson <lee.m.hen...@gmail.com> wrote:
> Check:
>
> http://github.com/leemhenson/javascriptmvc/commit/30c90b02f8193388dc2...
Reply all
Reply to author
Forward
0 new messages