pkdevbox / iui

Automatically exported from code.google.com/p/iui
MIT License
0 stars 0 forks source link

Ability to prevent default action of toggle button #296

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I wanted to be able to accept a toggle event, submit a server query, then 
toggle the state of the button upon receipt of the response from the server 
(the action may fail, in which case I wanted to leave the state alone; at the 
very least I wanted to wait for server confirmation before indicating the 
change to the user).

To that end, I made the following change to iui.js (line ~346):

The line that says:
div.setAttribute("toggled", div.getAttribute("toggled") != "true");

I changed to:
if (!hasClass(div, "defer"))
iui.toggle(div);

And moved the original line of code upwards to around line 254 where I made it 
part of window.iui:

toggle: function(div) {
div.setAttribute("toggled", div.getAttribute("toggled") != "true");
},

(Don't forget the comma after the } from the function above it, or you'll get a 
JavaScript error.)

Original issue reported on code.google.com by eslind...@gmail.com on 3 Aug 2011 at 4:34

GoogleCodeExporter commented 8 years ago

Original comment by msgilli...@gmail.com on 19 Jan 2012 at 5:15