Knockout.js textInput binding

Knockout.js added the textInput binding in version 3.2. This has been a big improvement over the standard value binding. Both provide two-way data-binding, but the value binding updates after the input field loses focus, while the textInput binding updates instantly. There has been a valueUpdate parameter available for the value binding, but it has not worked reliably for me. I set the valueUpdate parameter to keypress, but it still did not provide a reliable instant update for me. That has been totally resolved with the new textInput binding. The one thing I am not sure about is the performance impact of using textInput over value, so I have only been using it on fields where it is important to get the instant updates. Some of those fields are quantity or price fields so I can dynamically update the extended price and order totals while the user is entering data and not so much on name fields where it doesn’t matter to get the instant update.

Leave a Reply

Your email address will not be published. Required fields are marked *