PDA

View Full Version : Button click event is not working - In Window toolbar



kanchan@rhytha.co.in
10 Oct 2012, 10:56 PM
I have a window with toolbar that having button. but button click is not working with controller (MVC) -

controller code -

,init: function() {
this.control({
'window toolbar button[action=save]': {
click: function(e) {
alert('s', 's');
}
}
}
});
}

I also tried without toolbar -

,init: function() {
this.control({
'window button[action=save]': {
click: function(e) {
alert('s', 's');
}
}
}
});
}

Any Idea ?

Elfayer
10 Oct 2012, 11:27 PM
I'm not sure what you are doing, sorry if I misunderstand, but don't you want something like that?
=>


init: function() {
this.control({
'#idOfTheComponent': {
click: function(e) {
alert('s');
}
}
});
}

or



init: function() {
this.control({
'aliasOfTheComponent': {
click: function(e) {
alert('s');
}
}
});
}

kanchan@rhytha.co.in
11 Oct 2012, 12:33 AM
Hi Elfayer (http://www.sencha.com/forum/member.php?464280-Elfayer),

Thank you for reply..
As i asked i have window and inside window toolbar and toolbar having button ..
Now according to your code may i know please how to access button click event .. you indicating only window component .. where is button ?

init: function() {
this.control({
'aliasOfTheComponent': {
click: function(e) {
alert('s');
}
}
});
}

Elfayer
11 Oct 2012, 1:14 AM
You should use that code:

init: function() {
this.control({
'#buttonId': {
click: function() {
// Here you are in the click event of the button
}
}
});
}

kanchan@rhytha.co.in
11 Oct 2012, 1:54 AM
I fixed it B)B)B)