PDA

View Full Version : [DUP] onContainerMouseEnter never called on Ext.view.View



jcdang
30 Oct 2013, 11:44 AM
https://fiddle.sencha.com/fiddle/19s
(https://fiddle.sencha.com/fiddle/19s)
Ext version tested:

Ext 4.2.1 rev ____
Browser versions tested against:

Chrome 30.0.1599.101
DOCTYPE tested against:

<!DOCTYPE html>
Description:

Ext.view.View Container events are never triggered
Steps to reproduce the problem:

Create a data view
add container functions like onContainerMouseEnter
hover mouse over the container
The result that was expected:

onContainerMouseEnter should be called
The result that occurs instead:

nothing

Gary Schlosberg
30 Oct 2013, 1:50 PM
Perhaps you are looking for containermouseover (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.view.View-event-containermouseover) instead?

jcdang
31 Oct 2013, 1:00 PM
I'm looking for this mechanism but it's not working whatever the signature or event is called. The fiddle has been updated to show that both don't work. onContainerMouseEnter was the function that was called after patching the code.

The issue and the fix I used is here:

processUIEvent: function(e) {

// If the target event has been removed from the body (data update causing view DOM to be updated),
// do not process. isAncestor uses native methods to check.
if (!Ext.getBody().isAncestor(e.target)) {
return;
}


var me = this,
item = e.getTarget(me.dataRowSelector || me.itemSelector, me.getTargetEl()),
map = me.statics().EventMap,
index, record,
type = e.type,
newType = e.type,
sm;


// If the event is a mouseover/mouseout event converted to a mouseenter/mouseleave,
// use that event type and ensure that the item is correct.
if (e.newType) {
newType = e.newType;
item = e.item;
}


// For keydown events, try to get either the last focused item or the selected item.
// If we have not focused an item, we'll just fire a container keydown event.
if (!item && type == 'keydown') {
sm = me.getSelectionModel();
record = sm.lastFocused || sm.getLastSelected();
if (record) {
item = me.getNode(record, true);
}
}

// jcdang: I added this line
var isItemDom = Ext.DomQuery.is(item, me.itemSelector);
//if (item) { /// <---- this breaks container events from firing
if (isItemDom) {
if (!record) {
record = me.getRecord(item);
}
index = me.indexInStore ? me.indexInStore(record) : me.indexOf(item);


// It is possible for an event to arrive for which there is no record... this
// can happen with dblclick where the clicks are on removal actions (think a
// grid w/"delete row" action column) or if the record was in a page that was
// pruned by a buffered store.
if (!record || me.processItemEvent(record, item, index, e) === false) {
return false;
}


if (
(me['onBeforeItem' + map[newType]](record, item, index, e) === false) ||
(me.fireEvent('beforeitem' + newType, me, record, item, index, e) === false) ||
(me['onItem' + map[newType]](record, item, index, e) === false)
) {
return false;
}


me.fireEvent('item' + newType, me, record, item, index, e);
}
else {
if (
(me.processContainerEvent(e) === false) ||
(me['onBeforeContainer' + map[type]](e) === false) ||
(me.fireEvent('beforecontainer' + type, me, e) === false) ||
(me['onContainer' + map[type]](e) === false)
) {
return false;
}


me.fireEvent('container' + type, me, e);
}


return true;
}

Gary Schlosberg
31 Oct 2013, 5:43 PM
Thanks for the report! I have opened a bug in our bug tracker.