var viewModel = {
...
defaultTextProject: ko.observable(),
...
}
function assignProject(params) {
var projectNo = params.itemData["projectNo"];
viewModel.selectedProjectTile(projectNo);
var projectName = params.itemData["projectName"];
aktivEmployee.aktivProjectId = projectNo;
aktivEmployee.projectName = projectName;
viewModel.aktivProjectId(projectNo);
viewModel.defaultTextProject(projectNo + " " + projectName);
When I hit the last line in the above aktiveEmployee.aktivProjectId and aktivEmployee.projectName become undefined. However, vars projectNo and projectName retain their assigned values. All the other properties for the aktivEmployee object remain as they should.
Also, after the last line viewModel.defaultTextProject() displays what I want which shows the vars mentioned above still keeping their names but my aktivEmployee objects .aktivProjectId and .projectName are losing these values.
My first thought was the viewModel changing was losing them but it doesn't happen until the 3rd viewModel update so there's something here I'm not understanding with Javascript objects.
Does anyone have any idea what's going on here?
Thanks in advance!