Hello,
I have a toggle button that I use in more than one place. I would like to have the state of the toggle button updated across all copies of the button. I am currently using Ext.Action, but the toggle method is not a standard action, so the state doesn't get copied to all occurrences of the button.
I tried extending the Ext.Action to handle the toggle method, but I think I'm missing something. Here's what I tried:
Ext.ux.ActionToggle = Ext.extend(Ext.Action, {
toggle: function(state) {
this.initialConfig.pressed = state;
this.callEach('toggle', [state]);
}
});
This didn't do the trick. I used Firebug and found that this method never gets called. Any ideas what I'm doing wrong? Any suggestion on how to update the toggle state of all toggle buttons? Making the X Window System Accessible to People with Disabilities:: For example, if a toggle button were to get input focus in a dialog box, which is the Disability Action Committee for X. All implementations will be http://trace.wisc.edu/docs/x_win_disability/x_disabl.htmHOME |
Firefox 2.0 annoyances [Archive] - Ubuntu Forums:: 31 posts - Last post: Aug 7, 2007[Archive] Firefox 2.0 annoyances General Help. Secondly, I have set files to perform a certain action when clicked but they don't even http://ubuntuforums.org/archive/index.php/t-288048.htmlHOME |
Thanks,
Tim
Sorry Brian, I should have posted a little more code.
You're correct. My extend code was fine. The problem was that I wasn't calling the action.toggle method in the toggleHandler event.
I checked the source of the button control before posting and found that the toggle method is called before the toggleHandler handler function, and I thought this would do it. I wasn't differentiating the button.toggle method and the action.toggle method, but I think I understand now.
Thanks,
Tim
That looks fine so far. Since you didn't post any other code, there's no telling what your issue is. However, this should work:
Ext.ux.ToggleAction = Ext.extend(Ext.Action, {
toggle: function(state) {
this.initialConfig.pressed = state;
this.callEach('toggle', [state]);
}
});
Ext.onReady(function(){
var toggler = new Ext.ux.ToggleAction({
enableToggle: true,
text: 'Toggle me!',
renderTo: document.body,
toggleHandler: function(btn, state){
this.setText('Toggled = '+state);
toggler.toggle(state);
}
});
var btn = new Ext.Button(toggler);
var btn2 = new Ext.Button(toggler);
var btn3 = new Ext.Button(toggler);
});
Red Hat's Rough Recovery From CFO Exit
Windows Live Finds a New, Pre-installed Home
|