(function() { BemsWebApplication.CmMenuViewModel = function(data) { this.SiteId = ko.observable(); this.MenuId = ko.observable(); this.Used = ko.observable(); this.MenuPath = ko.observable(); this.Name = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.CmMenuViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), MenuId: this.MenuId(), Used: this.Used(), MenuPath: this.MenuPath(), Name: this.Name(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.MenuId(data.MenuId); this.Used(data.Used); this.MenuPath(data.MenuPath); this.Name(data.Name); } } }); })();