durandal

Breezejs EntityManager MetadataStore and fetchEntityByKey

馋奶兔 提交于 2019-12-10 05:33:51
问题 I have a SPA application (durandaljs), and I have a specific route where I map the "id" of the entity that I want to fetch. The template is "/#/todoDetail/:id". For example, "/#/todoDetail/232" or "/#/todoDetail/19". On the activate function of viewmodel, I get the route info so I can grab the id. Then I create a new instance of breezejs EntityManager to get the entity with the given id. The problem is when I call manager.fetchEntityByKey("Todos", id), the EntityManager doesn't have yet the

How to reference the bundled js files (asp.net mvc4) in Require.js?

回眸只為那壹抹淺笑 提交于 2019-12-09 04:27:50
问题 I have been studying John Papa's pluralsight course on SPA. In his main.js , he gave a name to each js library which is included in the bundle. (function () { var root = this; define3rdPartyModules(); function define3rdPartyModules() { // These are already loaded via bundles. // We define them and put them in the root object. define('jquery', [], function () { return root.jQuery; }); define('ko', [], function () { return root.ko; }); define('amplify', [], function () { return root.amplify; })

Responsive Durandal dialog

不羁的心 提交于 2019-12-08 23:33:52
问题 I'm using Durandal in my new application and I have an issue with Durandal's dialog window (I'm using it to get some data from users). When I set width of window manually, (by default Durandal set window position from JavaScript) and if I want to have window width 600px , I need to do that through CSS with .dialog { width: 600px! important} . and that's where all the problems starts. On window resize, dialog is not responsive anymore, and when I have big form in it and window height is small,

Binding around 5000 records using knockout

限于喜欢 提交于 2019-12-08 13:59:37
问题 I am trying to show around 5000 records in a web page using knockout observable array, which is taking hell lot of time, Is there any way to handle this without pagination?? please help.. JS code in view model, data is coming via ajax call in gridData source: groupGrid.prototype.updateGrid = function (gridDataSource, groupGridOptions) { var self = this; self.ColumnName(groupGridOption.ColumnNameList); // List of column name available in the data source. self.gridData(gridDataSource); //

What kind of questions should be asked when choosing between straight MVC4 and a SPA framework like Durandal or Angular?

半城伤御伤魂 提交于 2019-12-08 09:58:22
问题 I'm in the middle of making this choice right now and I don't know what kinds of questions I should be asking. One that I believe is valid: Do I need SEO / natively crawlable pages? If so, stick with MVC4. One question that I'm not sure about is the impact on performance - I think this is valid: Is initial load time very important? If so, stick with MVC4 (like stackoverflow). What are some other questions that should be asked that can help point a developer in the right direction here? PS -

HotTowel Durandal Inject different views based on the user

风格不统一 提交于 2019-12-08 07:44:20
问题 In the shell.html for HotTowel template we have: <!--ko compose: {model: router.activeItem, afterCompose: router.afterCompose, transition: 'entrance'} --> <!--/ko--> which will automatically insert the proper view by convention. I am trying to inject different views based on the user's role in a HotTowel/Durandal App. For example, I have two Views, productEditor_Admin.html productEditor_Superviser.html (instead of these two views, I used to have only productEditor.html, by convention

Durandal TodoMVC - Cannot write a value to a ko.computed

女生的网名这么多〃 提交于 2019-12-08 01:28:21
问题 I'm trying to build a version of the todo app using Durandal (including Knockout + RequireJS) from a TodoMVC template. I realize that a todo app doesn't really show off the features of Durandal, but I'm on the learning path and figured it would be a good first project. Anyway, in the process I've stumbled upon an error that I'm unable to solve (see below). Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any

prevent anchor tag from navigating to home page

混江龙づ霸主 提交于 2019-12-08 01:18:30
问题 I have a regular anchor tag with href attribute set to "#". Normally, this prevents from any navigation but in durandal it navigates me to the home view. How can I stop it from navigating to that view? I can't change the html and stylings. It needs to be that anchor tag. But I can bind a click event to it. Is there any way to cancel navigation in anchor click event? regards 回答1: Bind a click event to it and call event.preventDefault() <a href="#" id="someAnchor">Example</a> $(function() { $('

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

Conditional routing in Durandal

我与影子孤独终老i 提交于 2019-12-07 18:48:36
问题 In my HotTowel based project, I'm using Durandal 1.1.1 for routing. I have a login route, which I want to activate if the user is not logged in. my route config is like: var routes = [ { url: 'login', moduleId: 'viewmodels/login', name: 'Login', visible: true, caption: 'Login' },{ url: 'moduledetail/:id', moduleId: 'viewmodels/moduledetail', name: 'ModuleDetail', visible: true, caption: 'ModuleDetail' } I want if user want to go #/moduledetail/1 and is not authenticated yet, the browser