Foros de discusión
how to access the element the datepicker is assigned to in the callback sel
Ivano Carrara, modificado hace 8 años.
how to access the element the datepicker is assigned to in the callback sel
Expert Mensajes: 345 Fecha de incorporación: 3/07/05 Mensajes recientes
There is a tutorial http://alloyui.com/versions/2.0.x/examples/datepicker/ where this code is given:
My question is how to access the element the datepicker is assigned to, i. e. the button, in the callback selectionChange?
I tried to read the complete documentation but I didn't understand it.
Thank you in advance for any help !
Ivano C.
YUI().use(
'aui-datepicker',
function(Y) {
new Y.DatePicker(
{
trigger: 'button',
popover: {
zIndex: 1
},
on: {
selectionChange: function(event) {
console.log(event.newSelection)
}
}
}
);
}
);
My question is how to access the element the datepicker is assigned to, i. e. the button, in the callback selectionChange?
I tried to read the complete documentation but I didn't understand it.
Thank you in advance for any help !
Ivano C.
Kyle Joseph Stiemann, modificado hace 8 años.
RE: how to access the element the datepicker is assigned to in the callback
Liferay Master Mensajes: 760 Fecha de incorporación: 14/01/13 Mensajes recientes
Hi Ivano,
To obtain the trigger element during the selectionChange event, you can do the following:
selectionChange: function(event) {
var triggerNode = Y.one(event.target.get('trigger'));
// Your code here ...
}
See my answer to the same question on Stack Overflow for more details and a runnable example.
- Kyle
To obtain the trigger element during the selectionChange event, you can do the following:
selectionChange: function(event) {
var triggerNode = Y.one(event.target.get('trigger'));
// Your code here ...
}
See my answer to the same question on Stack Overflow for more details and a runnable example.
- Kyle
Ivano Carrara, modificado hace 8 años.
RE: how to access the element the datepicker is assigned to in the callback
Expert Mensajes: 345 Fecha de incorporación: 3/07/05 Mensajes recientes
Thank you Kyle !
And excuse me for the double post ...
Ivano C.
And excuse me for the double post ...
Ivano C.
Kyle Joseph Stiemann, modificado hace 8 años.
RE: how to access the element the datepicker is assigned to in the callback
Liferay Master Mensajes: 760 Fecha de incorporación: 14/01/13 Mensajes recientes
Glad I could help! Please mark my post as an answer here and on Stack Overflow if it answers the question.
- Kyle
- Kyle