librelist archives

« back to archive

disabling mapgrid rowexpander's onmousedown behavior

disabling mapgrid rowexpander's onmousedown behavior

From:
Sebastian Benthall
Date:
2010-07-06 @ 21:07
Emailing list for group edification, but mostly for Andreas:

http://github.com/GeoNode/geonode/commit/55c0b999248a273fa3179e7e64e2c021b9dfb411


<http://github.com/GeoNode/geonode/commit/55c0b999248a273fa3179e7e64e2c021b9dfb411>Mad
this change to the Ext-based MapGrid.  I note it here because I couldn't
figure out a cleaner (event-driven) way to disable the expander plugin
button except the hacky way I did it.

I think the way the RowExpander is designed makes it much more trouble than
its worth to unbind the 'mousedown' event (the binding of the rowToggle
behavior to the mousedown event happens when the grid's view is rendered,
but the declaration happens when the expander itself is initialized, so the
timing is tricky--i tried!).  But I wanted to invite your review in case you
see a better way to do it that escaped me.

-- 
Sebastian Benthall
OpenGeo - http://opengeo.org

Re: [geonode] disabling mapgrid rowexpander's onmousedown behavior

From:
Andreas Hocevar
Date:
2010-07-06 @ 22:56
Hey Seb-

you can try to not override onMouseDown at all, but instead add the 
following as first line of your rowclick handler:

evt.stopEvent();

This is a good idea in general, to avoid other event handlers being 
triggered (like e.g. field editors).

-Andreas.

On Jul 6, 2010, at 23:07 , Sebastian Benthall wrote:

> Emailing list for group edification, but mostly for Andreas:
> 
> 
http://github.com/GeoNode/geonode/commit/55c0b999248a273fa3179e7e64e2c021b9dfb411
> 
> Mad this change to the Ext-based MapGrid.  I note it here because I 
couldn't figure out a cleaner (event-driven) way to disable the expander 
plugin button except the hacky way I did it. 
> 
> I think the way the RowExpander is designed makes it much more trouble 
than its worth to unbind the 'mousedown' event (the binding of the 
rowToggle behavior to the mousedown event happens when the grid's view is 
rendered, but the declaration happens when the expander itself is 
initialized, so the timing is tricky--i tried!).  But I wanted to invite 
your review in case you see a better way to do it that escaped me.
> 
> -- 
> Sebastian Benthall
> OpenGeo - http://opengeo.org
> 

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

Re: [geonode] disabling mapgrid rowexpander's onmousedown behavior

From:
Sebastian Benthall
Date:
2010-07-07 @ 15:26
Thanks for the tip.  Didn't help exactly because the it was on a different
event (the mousedown, not the click) and on a different object (the grid's
view's mainBody, whatever that is...)

However I made the fix here:

http://github.com/GeoNode/geonode/commit/6b54ac1f5ebdf0f863a565107ed1da45d309aa12

Taking another crack at it, I found a way around this by adding an 'init'
event to the RowExpander.  I guess it's cleaner, though really it feels like
hacking around the RowExpander in a more convoluted way.

http://github.com/GeoNode/geonode/commit/3fb9f92e1d10c1797913d77fe359a6f5020f1c18

Oh well.  Will let this one rest I think unless anybody has any other
objections/suggestions.

On Tue, Jul 6, 2010 at 6:56 PM, Andreas Hocevar <ahocevar@opengeo.org>wrote:

> Hey Seb-
>
> you can try to not override onMouseDown at all, but instead add the
> following as first line of your rowclick handler:
>
> evt.stopEvent();
>
> This is a good idea in general, to avoid other event handlers being
> triggered (like e.g. field editors).
>
> -Andreas.
>
> On Jul 6, 2010, at 23:07 , Sebastian Benthall wrote:
>
> > Emailing list for group edification, but mostly for Andreas:
> >
> >
> 
http://github.com/GeoNode/geonode/commit/55c0b999248a273fa3179e7e64e2c021b9dfb411
> >
> > Mad this change to the Ext-based MapGrid.  I note it here because I
> couldn't figure out a cleaner (event-driven) way to disable the expander
> plugin button except the hacky way I did it.
> >
> > I think the way the RowExpander is designed makes it much more trouble
> than its worth to unbind the 'mousedown' event (the binding of the rowToggle
> behavior to the mousedown event happens when the grid's view is rendered,
> but the declaration happens when the expander itself is initialized, so the
> timing is tricky--i tried!).  But I wanted to invite your review in case you
> see a better way to do it that escaped me.
> >
> > --
> > Sebastian Benthall
> > OpenGeo - http://opengeo.org
> >
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>


-- 
Sebastian Benthall
OpenGeo - http://opengeo.org

Re: [geonode] disabling mapgrid rowexpander's onmousedown behavior

From:
Sebastian Benthall
Date:
2010-07-07 @ 15:35
Actually, had to remove the stopEvent() since it was breaking the links on
the expander and the grid elements.

Could just stop the event propagation and not the browser default behavior,
but I'm not sure if that really gets us anything?

On Wed, Jul 7, 2010 at 11:26 AM, Sebastian Benthall <seb@opengeo.org> wrote:

> Thanks for the tip.  Didn't help exactly because the it was on a different
> event (the mousedown, not the click) and on a different object (the grid's
> view's mainBody, whatever that is...)
>
> However I made the fix here:
>
>
> 
http://github.com/GeoNode/geonode/commit/6b54ac1f5ebdf0f863a565107ed1da45d309aa12
>
> Taking another crack at it, I found a way around this by adding an 'init'
> event to the RowExpander.  I guess it's cleaner, though really it feels like
> hacking around the RowExpander in a more convoluted way.
>
>
> 
http://github.com/GeoNode/geonode/commit/3fb9f92e1d10c1797913d77fe359a6f5020f1c18
>
> Oh well.  Will let this one rest I think unless anybody has any other
> objections/suggestions.
>
> On Tue, Jul 6, 2010 at 6:56 PM, Andreas Hocevar <ahocevar@opengeo.org>wrote:
>
>> Hey Seb-
>>
>> you can try to not override onMouseDown at all, but instead add the
>> following as first line of your rowclick handler:
>>
>> evt.stopEvent();
>>
>> This is a good idea in general, to avoid other event handlers being
>> triggered (like e.g. field editors).
>>
>> -Andreas.
>>
>> On Jul 6, 2010, at 23:07 , Sebastian Benthall wrote:
>>
>> > Emailing list for group edification, but mostly for Andreas:
>> >
>> >
>> 
http://github.com/GeoNode/geonode/commit/55c0b999248a273fa3179e7e64e2c021b9dfb411
>> >
>> > Mad this change to the Ext-based MapGrid.  I note it here because I
>> couldn't figure out a cleaner (event-driven) way to disable the expander
>> plugin button except the hacky way I did it.
>> >
>> > I think the way the RowExpander is designed makes it much more trouble
>> than its worth to unbind the 'mousedown' event (the binding of the rowToggle
>> behavior to the mousedown event happens when the grid's view is rendered,
>> but the declaration happens when the expander itself is initialized, so the
>> timing is tricky--i tried!).  But I wanted to invite your review in case you
>> see a better way to do it that escaped me.
>> >
>> > --
>> > Sebastian Benthall
>> > OpenGeo - http://opengeo.org
>> >
>>
>> --
>> Andreas Hocevar
>> OpenGeo - http://opengeo.org/
>> Expert service straight from the developers.
>>
>>
>
>
> --
> Sebastian Benthall
> OpenGeo - http://opengeo.org
>
>


-- 
Sebastian Benthall
OpenGeo - http://opengeo.org

Re: [geonode] disabling mapgrid rowexpander's onmousedown behavior

From:
David Winslow
Date:
2010-07-06 @ 21:18
I know we don't have any official policies about review practices or 
whatever.  But when a change is so hacky/tricky/whatever that you feel 
like you need to warn everyone about it, I'd appreciate posting it 
somewhere other than GeoNode/geonode for review first, rather than 
(effectively) asking for a review of something you already committed.

Not directly at Seb, this is just a good example of what I'm talking about.

--
David Winslow
OpenGeo - http://opengeo.org/

On 07/06/2010 05:07 PM, Sebastian Benthall wrote:
> Emailing list for group edification, but mostly for Andreas:
>
> 
http://github.com/GeoNode/geonode/commit/55c0b999248a273fa3179e7e64e2c021b9dfb411
>
> Mad this change to the Ext-based MapGrid.  I note it here because I 
> couldn't figure out a cleaner (event-driven) way to disable the 
> expander plugin button except the hacky way I did it.
>
> I think the way the RowExpander is designed makes it much more trouble 
> than its worth to unbind the 'mousedown' event (the binding of the 
> rowToggle behavior to the mousedown event happens when the grid's view 
> is rendered, but the declaration happens when the expander itself is 
> initialized, so the timing is tricky--i tried!).  But I wanted to 
> invite your review in case you see a better way to do it that escaped me.
>
> -- 
> Sebastian Benthall
> OpenGeo - http://opengeo.org
>