Background
Knockout (AKA KnockoutJS) is a javascript library which implements the Model View ViewModel architectural pattern to help build rich, responsive displays and user interfaces. The library allows for:
- Dependency tracking - automatically updates the right parts of your UI whenever your data model changes.
- Declarative bindings - a simple and obvious way to connect parts of your UI to your data model. You can construct a complex dynamic UIs easily using arbitrarily nested binding contexts.
Within DotNetNuke
Knockout was first added in the 6.2.0 release of DotNetNuke and is used in many of the components introduced in that version including the message centre, journal and member directory. In addition other areas such as the user profile were enhanced to use it. In the cases of the member directory and user profile, these extensions both expose the knockout scripts as templates so that site administrators can apply their own markup if desired.
If you wish to include knockout in your own extensions (targetted 6.2.0 and beyond releases), it's recommend that you use the Client Resource Management API to ensure only a single copy of the script is included and that it is minimized and compacted (if your install has chosen those options). To do so use the following line:
<dnn:DnnJsInclude ID="DnnJsInclude" runat="server" FilePath="~/Resources/Shared/scripts/knockout.js" />
Note: since DNN 7.2.0 the recommended approach is to use the JavaScript library support e.g.
JavaScript.RequestRegistration(CommonJs.Knockout);
References