You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to KnockoutJS
i have a question about the "enable" binding.
i have a jquery mobile button which i want to enable or disable upon a
condition. it works as expected, but jquery mobile has a special
method to enable or disable the button visually ($
('#mybutton').button('disable');). so the default enable action of
knockout.js is not enough is this case. how can i extend it to include
the jquery mobile specific method call?
best regards
oliver bruening
rpn
unread,
May 15, 2011, 9:41:14 AM5/15/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to knock...@googlegroups.com
Hello-
Typically, you would want to use a custom binding for this type of action. An easy thing to do is to write a "wrapper" to one of the exisiting bindings.
For yours it might look something like:
ko.bindingHandlers.jQueryButtonEnable = { update: function(element, valueAccessor) { //first call the real enable binding ko.bindingHandlers.enable.update(element, valueAccessor); //do our extra processing var value = ko.utils.unwrapObservable(valueAccessor()); $(element).button(value ? "enable" : "disable"); } };
your code throws an exception, something like "called disable on button prior to initialization"
Message has been deleted
john...@gmail.com
unread,
Mar 18, 2014, 11:24:51 AM3/18/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to knock...@googlegroups.com
The 'refresh' option didn't change my input field styling back to look "enabled". Use rpn's code, but add a Try Catch to swallow the "called disable...." exception.