durandal

JQuery doesn't locate DOM elements when using Durandal's compose

浪尽此生 提交于 2019-12-03 10:08:14
I've recently ported my company's project to Durandal using Knockout and JQuery. Straight to the problem: I need to initialize JQuery UI's datepicker using two HTML inputs. JQuery, however, is unable to locate the inputs when I do this: view: <div data-bind="if: !CurrentUser()"> <h1 data-bind="html: DisplayName"></h1> <div data-bind="compose: 'users/_UsersList.html'"></div> </div> <div data-bind="with: CurrentUser(), visible: CurrentUser()"> <h1>User detail</h1> <div data-bind="compose: 'users/_UserDetail.html'"></div> </div> viewmodel - SelectUser() function is called when a user is selected

Durandal: How to route away from current view within that view's activate() function?

大兔子大兔子 提交于 2019-12-03 08:55:55
I have the following: function activate(routeData) { // make dataservice call, evaluate results here. If condition is met, reroute: if (true){ router.navigateTo("#/someRoute"); } alert ("should not be shown"); } The alert is getting hit however, and then the view changes. How do I fully navigate away from the current item and prevent any further code in that vm from being hit? Update: I tried using guardroute but I have to activate the viewModel to call the dataservice that returns the data that determines whether or not I should re-route. Using guardroute totally prevents the dataservice from

Can Durandaljs do Areas

自古美人都是妖i 提交于 2019-12-03 08:45:13
I'm trying to see if there is a way to do areas in Durandaljs Something along the lines of /App/areas/home /views /viewmodels /other /views /viewmodels I see the viewLocator allowing this convention: viewLocator.useConvention('viewmodels', 'views', 'areas'); but the router.useConvention() seems to default to same path. Is there a proper way to account for this, the documentation is light in this regard. yes you can do this. Since you are using Durandal.router you can use a convention of where to find your ViewModels by overriding the routers autoConvertRouteToModuleId like so: router

How to pass data (selected item) to Durandal composed detail view?

安稳与你 提交于 2019-12-03 07:31:51
I've started using (as of, a few hours ago) Durandal with the hope to manage views and allow composition within a single page - the previous approach, also using Knockout, was getting too unwieldy to maintain in a fat HTML file. I've installed/setup Durandal and I can create views and viewmodels - however, I don't know how to get data into the viewmodel to use as a basis for the new viewmodel. For instance, I have a "left nav bar" for selecting items - when an item is selected it updates a "selected item" observable in the current model, but it should also load the correct "detail view" in the

Use Twitter Bootstrap button group as radio select with knockout bindings

馋奶兔 提交于 2019-12-03 06:48:31
This is working: view.html <div><input type="radio" name="radioPriority" data-bind="checked: priority" value="want" style="margin-top: -3px; margin-right: 3px;" />I want to</div> <div><input type="radio" name="radioPriority" data-bind="checked: priority" value="need" style="margin-top: -3px; margin-right: 3px;"/>I need to</div> controller.js function feedbackViewModel() { var self = this; self.priority = ko.observable("want"); //lots of other stuff } As expected, when you select the second radio the priority observable's value changes to "need". However, I'd like to use a Twitter Bootstrap

Durandal and ASP.NET MVC conventions

北战南征 提交于 2019-12-03 06:13:31
I'm currently evaluating Durandal for use in an enterprise ASP.NET MVC application. However the default conventions used by Durandal seem to conflict with the MVC conventions I've grown accustomed to. The HotTowel MVC template by John Papa is great, but this too seems to "do away" with MVC conventions in favour of Durandals by putting things in an App folder. A couple of the issues I have with these conventions are: Views are potentially split across two locations (/App/views and /Views). Scripts are also split across two locations (/App/durandal and /Scripts). Views are not in the default MVC

Durandal (knockout) app with multilanguage support

前提是你 提交于 2019-12-03 05:09:27
问题 I am building multilingual support for the app I'm working on. After doing some research and reading SO (internationalization best practice) I am trying to integrate that in a 'framework-friendly' way. What I have done at the moment is following: Created .resource modules formatted like so: resources.en-US.js define(function () { return { helloWorlLabelText: "Hello world!" } }); On the app.start I get the resource module with requirejs and assign all data to app.resources. Inside of each

Translating views with HotTowel (Durandal framework) + VS2012

我怕爱的太早我们不能终老 提交于 2019-12-03 03:44:11
I develop an ASP.NET MVC solution with Durandal and Breeze. I need to translate frontend to french and dutch. How to proceed with Durandal/knockout? In a classic ASP.NET MVC solution we have the opportunity to have the views rendered server side (thanks to razor). Thanks for your help. To expand on Rob's answer of trying the i18n.js plugin for require.js, here's the steps I followed (I'm working off the Durandal starter template in Visual Studio). Download the i18n.js plugin and put it in the App folder. Create an App/nls folder, which is where you will put the require.js resource bundles, e.g

Durandal and MVC4 Areas for multiple SPAs

百般思念 提交于 2019-12-03 03:35:01
I have a internet application mvc4 with areas, for my organization each area represent a SPA and through "Manage NuGet Package" I installed "Durandal 1.2.0", "Durandal Transitions 1.2.0" and "Durandal Router 1.2.0". I organized the folders and quit the "views" and "viewmodels" from folder "App" of Durandal and put the new views in folder "VIews" of mvc4 area for example: Areas-->NewArea-->Views-->ControllerFolder-->views-->shell.html Then I put the '"viewmodels" in "Script" folder for example: Scripts-->NewArea-->ControllerFolder-->viewmodels-->shell.js Scripts-->NewArea-->ControllerFolder--

Integrate the koGrid with the Durandal/HotTowel template

安稳与你 提交于 2019-12-03 02:59:01
I work on an asp.net solution with the Durandal template. I try to use the koGrid ( https://github.com/Knockout-Contrib/KoGrid ) which is compatible with knockout. When inserting this grid in a test page managed by Durandal, it doesn't work: the grid seems to be there but not correctly displayed. We noticed that if we resize the window, then the grid adjust correctly. Does anyone already succeed integrate this koGrid in a Durandal/HotTowel template? Steps to reproduce the problem: Create a new ASP.NET MVC project and choose the Durandal template Add the koGrid in the project (available in