knockout.js - Unable to update observable value in subscribe method -


i have subscribe function fires when dropdown value changes. want update observable value inside subscribe function. probelm when control leaves subscribe function observable value got null or empty.

self.selectedsubaccount.subscribe(function (newvalue) {  //alert("the selected account code:" + newvalue);  var likecode = newvalue.substring(0, 2);  var acctype = "control";  self.account_code = genrateaccountcode(self.subaccounts(), likecode, acctype); }); 

assuming self.account_code observable, update so:

self.account_code(genrateaccountcode(self.subaccounts(), likecode, acctype)); 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -