knockout.js - How to update corresponding UI using Knockout? -


The same function has two controls in my format but the control type is different from each other, there is a text box Dropdown is a list.

In my case if the user selects an option from the dropdown, the text box value is updated dynamically, but the problem occurs when I type the value in the text box, dropdown list It is not updated if it has typed a single character, it will work fine, but I have trouble, where I had typed more than one character code.

Here Js Fiddle:

  jsfiddle.net/rohit421991/c38hkdag/32/   

I think I have a wrong incidence Is used and I am using the keyboard event. Please tell me what is the best way to do this and how can we achieve it?

OK I think I have found a solution :) Please note that I too New to

The first thing to do ... is the wrong way to do this in connection with the keyboard binding, something like a subscription becomes more understandable ....

Then Here's my solution:

  jsfiddle.net/2kx9g6es/8/   

I've changed some small things:

  1. Changed the data table to keep fewer case names
  2. The name has been changed to vm because the code becomes more understandable + the text is used as an element atr Therefore, it is not possible to use good practice text
  3. Cheat by using events, now subscribe
  4. Subscribe to jquery when ready to avoid any strange errors

    The code could be a wii, a little confusing around the interview, but that was because I had encountered the keyboard before it did not work ... basically all this Changing on one of them, What that looks at number two this value is not correct, if it, update it. Additional codes around it have to be resolved to trigger each other that triggers another (some type of loop)

    Perhaps someone is more elegant (using more reuse Worthy manner, possibly through custom binding!) This, but it should work.

    If you feel like improving your code, then I recommend that you issue a custom instruction to resolve the issue ... or perhaps to re-enable my subscription to make it more logical. Structure. / P>

    Hope this helps :)

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -