im starting to get my head around knockout and if its correct to write code in the viewmodel that manipulates the dom or fires animations etc. As an example i have this binding that passes in a reference to a div which i want to slide out when the tr is clicked
<tr data-bind="click: function(data, event){$parent.Select('#PanelWrapper', $data)}">
In my viewmodel i have
self.Select = function (panel, e) {
console.log(ko.toJS(e));
if(self.SelectedEmployee() === e)return;
self.$PanelWrapper = $(panel);
var $Bottom = parseInt(self.$PanelWrapper.css("bottom"));
if($Bottom === 0){
self.$PanelWrapper.animate({
bottom:"-95"
}, 500, function(){
self.SelectedEmployee(e);
self.Editable(new Employee(ko.toJS(e)));
}).animate({
bottom:"0"
}, 500);
}else{
self.SelectedEmployee(e);
self.Editable(new Employee(ko.toJS(e)));
self.$PanelWrapper.animate({
bottom:"0"
}, 500);
}
};
Im wondering if this is valid and that it follows the vmmv methodology. Any help would be appreciated