durandal-2.0

Durandal modal/dialog context that allows scrolling on mobile devices

旧街凉风 提交于 2020-01-25 01:09:22
问题 Durandal provides a modal dialog facility which works great on desktop devices, and it allows you to control the presentation of the dialog via the "dialog context". The default dialog context will, among other things, "display your dialog's view centered on the screen." Observationally, I can see that this means centering the dialog in the viewport--which means that as you scroll up and down, it remains in the same location, in the middle of your viewport. This works fine a screen large

How do you configure pathing in Durandal?

醉酒当歌 提交于 2020-01-17 05:08:10
问题 I'm a novice at Durandal but familiar with mvc4. I'm attempting to port an existing application that heavily uses knockout to a SPA framework. I've been able to get the standard View / ViewModel convention working with the information from this post: https://stackoverflow.com/a/15636715/1693081 I'd like to extend this to a feature based structure because each page has multiple reusable components, I'd like to set up my application directory as follows: App | |--- Pages | | | |---Shell | | | |

Durandal Event in widgets

丶灬走出姿态 提交于 2019-12-25 04:26:29
问题 So I have yet another DurandalJS question. So I have a few widgets that are pretty much self contained. They render or hide themselves depending on whether the current user is logged in or not e.g. I have a widget that displays the current users name, and another one that displays some setting for the current user. The 'current user is a value stored in local storage so everyone basically knows to get it from there and do their bit. I have a security module which triggers an event on itself

Responsive Dialog in Durandal 2.1?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 05:50:34
问题 I found the following: Responsive Durandal dialog However I don't see any documentation on making the dialog responsive in 2.1. I have a dialog that extends in height as the user selects stuff - eventually the dialog gets taller than the viewport and there's no scroll or anything so it's a total mess on mobile devices. I've tried using the "reposition" functionality from the docs but this doesn't seem to do much. Any advice around this would be much appreciated. dialog.show('viewmodels/doThis

Durandal router / lifecycle events when using a childRouter

旧巷老猫 提交于 2019-12-21 16:55:31
问题 In a single page app built using Durandal, I have a settings view, with different sections. I use a childRouter to resolve the different sections. In this application, a lot of code hooks into the composition lifecycle events that Durandal uses. For example, this custom binding: ko.bindingHandlers.autoFocus = { init: function (element) { var $element = $(element), setFocus = function () { $element.focus(); }; router.on('router:navigation:composition-complete', setFocus); ko.utils

Durandal 2.0 custom dialog

北慕城南 提交于 2019-12-19 03:20:49
问题 I wish to make a Durandal custom dialog that adds a window frame with title and footer around an existing composable viewmodel. I have made a customModal.html template <div class="messageBox"> <div class="modal-header"> <h3 data-bind="text: title"></h3> </div> <div class="modal-body"> <!--ko compose: { model: model, template: view }--> <!--/ko--> </div> <div class="modal-footer" data-bind="foreach: options"> <button class="btn" data-bind="click: function () { $parent.selectOption($data); },

implementing html5 drag and drop photos with knockout js , durandal 2.0

最后都变了- 提交于 2019-12-13 14:49:07
问题 I have a list of photos in a knockout js viewmodel and I want to be able to swap among them(actually the more correct term is copy one on top of another). Here is my simplified viewmodel: define(['durandal/app', 'knockout', 'jquery'], function(app, ko, jquery) { var miscPhotos = ko.observableArray(); var draggedPhoto = ko.observable(); function handleDragStart(data, e) { // e.preventDefault(); draggedPhoto(data); console.log('dragStart'); return true; } function handleDragOver(e) { e

Durandal js router setup

时光毁灭记忆、已成空白 提交于 2019-12-11 07:26:06
问题 I've managed to get a simple router working and even created a child router for my submenu but there are one or two things I'm not sure of why they're there. The docs give you a basic leg up and then you're on your own. So I'm reading the docs from here: http://durandaljs.com/documentation/Using-The-Router.html First, there's mention of "splat" routes but it doesn't really explain what they are or how you might use it. All you get is an example bit of JS which means nothing without showing

Durandal recursive composing of template

点点圈 提交于 2019-12-10 16:46:05
问题 I am trying to compose a template in my application recursively. I have a multi-dimensional array that I am trying to flatten out into table rows. I can get the first level to work great, but I cannot get subsequent levels to render properly. I know that Durandal requires the view to have a single root element. I am using a virtual container to compose my template. Here is my parent view <table class="table table-bordered table-hover"> <thead> <tr> <th>#</th> <th></th> <th>Condition</th> <th

Durandal constructor function but still want to remember data

微笑、不失礼 提交于 2019-12-07 19:44:10
问题 Let's say I have the following durandal code: define(['durandal/app', 'plugins/http'], function (app) { var vm = function(){ var self = this; self.myData = ko.observableArray([]); } }; vm.activate = function() { this.myData([]); }; vm.deactivate = function(){ }; return vm; }; I know by returning a constructor function, every time the view model is activated, it will return a new instance. My question is: is there anyway that when I access, if there's myData() from previous access, then I don