How to add change binding #52
Comments
By default, entering input should automatically update the data ( To listen to the change event: const { flow, setDefault, bindEvents } = simulacra
...
{
cells: [ 'td', {
value: [ 'input', flow(setDefault, bindEvents({
change(event, path) { ... }
})) ]
} ]
} I think that also you would need to wrap the value of the cell to output proper HTML: {
cells: [ { value: 'one' }, ... ]
} |
Thanks for the prompt response ... so this now works, with the exception that the underlying data value is not updated which is what you referred to. I'll log this here as a bug ... template = document.createElement('template') data = { rows:[ bindings = [ template, { outlet = document.body |
If you update to |
OK ... but I want to trap the changes to do some additional processing on the node? How would I do this? |
There's the |
Sorry for being dense but I am not seeing how this works in my example ... can you take a peek at https://jsfiddle.net/bnbnnqcy/ and tell me what the code is to trap the change event on all textboxes? Also, can I prevent a change based on some validation rule? |
I've updated it: https://jsfiddle.net/bnbnnqcy/2/ Basically you don't have to use the helper functions, you could just use |
sweet ... thanks. Now if we could just get it to flow the updates back to the data object, I'd be all set :-) |
Sure, it just adds one line: https://jsfiddle.net/bnbnnqcy/3/ |
Awesome ... thanks for all your help |
I have the following that works OK ...
How do I structure the bindings to add a change event to input box?
The text was updated successfully, but these errors were encountered: