PDA

View Full Version : Listener in checkboxgroup... onClick vs change ??



ppaweluz
22 Jun 2010, 9:19 AM
Hi!

I was thinking that this would be the simples think in the world, but unfortunately adding a click listener into checbox is a nightmare for me. Maybe someone could help me with that. My code looks like that:



var checkGroup = {
xtype: 'fieldset',
title: 'Filters >>>>',
layout: 'fit',
border: false,
hideBorders:true,
collapsed: true, // initially collapse the group
collapsible: true,
items: [{
xtype: 'checkboxgroup',
columns:1,
items: generateCheckboxes()
}]
};


function generateCheckboxes(){
return [
{boxLabel: 'name1', name: 'name1', onClick: onItemCheck}, // work but gives me nothing
{boxLabel: 'name2', name: 'name2', change: onItemCheck}// does not work at all
];
}

function onItemCheck(e){
console.info(e)
e.target;// does not work at all - some error in the firebug console!!!!!!!!!!!!!
e.getTarger()// I got info in firebug that 'e.getTarget() is not a function'

};
When I print the additional information about the 'e' object from the onItemCheck I got this info:



[object Object] browserEvent:
[object Event] button: -1
type: focus
shiftKey: undefined
ctrlKey: false
altKey: undefined
keyCode: undefined
charCode: undefined target:
[object HTMLInputElement]
xy: 0,0
setEvent: (function)
stopEvent: (function)
preventDefault: (function)
stopPropagation: (function)
getCharCode: (function)
getKey: (function)
normalizeKey: (function)
getPageX: (function)
getPageY: (function)
getXY: (function)
getTarget: (function)
getRelatedTarget: (function)
getWheelDelta: (function)
within: (function)
BACKSPACE: 8
TAB: 9
.
.//every keys
.
F12: 123
isNavKeyPress: (function)
isSpecialKey: (function)
getPoint: (function)
hasModifier: (function)So as you can see onClick works but gives me nothing, and change does not work at all. This is all I got. So the question is how to make onClick working well or what am I doing wrong that change listener does not work at all.

Can anyone please help me??

Regards,
Puol

Animal
22 Jun 2010, 12:06 PM
IMHO, the check event should bubble through the CheckboxGroup!

I feel an FR coming on.

paweluz
22 Jun 2010, 11:31 PM
Thank you very much Animal... it worked!