javascript-framework

Are there any knockoutjs page/routing frameworks?

邮差的信 提交于 2019-12-18 10:07:24
问题 Coming from asp.net MVC 3. In MVC4 they introduced WebAPI's. It would be nice to be able to do all view/routes code in javascript and just rely on MVC for API. Heck it's really cool that webapi's can be run independent of IIS! That being said: Are there any page frameworks that can leverage KnockoutJS which are similar to my mock-up below: Framework.RegisterRoutes(..,mainViewModel);//sets the CurrentViewModel? Each route being a separate file of a viewModel, and a view to be injected into the

Easiest way to interate over a complex JSON object via Javascript

☆樱花仙子☆ 提交于 2019-12-18 09:39:31
问题 I'm consuming JSON data that has a bit of a weird structure for example: { "RESULT": { "COLUMNS": ["ID","name","ENABLED","perms","vcenabled","vcvalue","checkenabled","checkvalue","indxenabled","indxvalue"], "DATA": [ [7,"Site-A", 1, "1,2", 1, 1, 1, 0, 0, 0], [15,"Site-B", 1, "1,2,3,4", 1, 1, 1, 0, 0, 0] ] }, "ERROR": 0 } I would like to create some JavaScript that would restructure this data to proper JSON structures so that the "Column" array values become the keys for the "DATA" array's

How to onclick-trigger a non-native jQuery plugin's action?

寵の児 提交于 2019-12-13 07:46:13
问题 I've installed a 3rd-party jQuery plugin (it's an accordion). It displays on my page, and works as expected. I want to trigger one of the plugin's actions (open a particular slide) when I click on an image on my page. I can't seem to get the code &/or syntax for doing that right. The plugin I've installed is "EasyAccordion" (http://www.madeincima.eu/blog/jquery-plugin-easy-accordion/). It's .js source is posted here: http://pastebin.com/55JB4pr2. I'm using the plugin on a Drupal7 page. I don

Passing a dynamic parameter different than xyz_id using linkTo in Ember.js

本秂侑毒 提交于 2019-12-13 04:56:47
问题 I've seen a lot of examples of passing dynamic parameters which end with xyz_id being passed where xyz is the "model". However, is there a way to pass an id different than xyz_id? Basically, given this fiddle: http://jsfiddle.net/xcNSa/11/ Can someone please show me how to pass in the video's code and type options as parameters instead of just the id. So, current link titled "Link to myself" points to: http://fiddle.jshell.net/xcNSa/11/show/#/video/1 I'd like it to point to: http://fiddle

mootools accordion not working

╄→尐↘猪︶ㄣ 提交于 2019-12-13 04:32:02
问题 I've been wanting to try out the Accordion effect on mootools but I can't get it to work, it's just like the js doesn't load at all this is the HTML code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>BarDiJan - We Deliver</title> <link rel="stylesheet" href="/stylesheets/reset.css"

Meteor js Windows install error “Failed to contact install server”

若如初见. 提交于 2019-12-13 01:16:11
问题 I have tried running the install with "Run as Admin" feature on windows too, but the same issue persists. I see this question has been posted before but still no resolution given. Basically the following error message comes in the middle of the install and the install stops. Please help. Error message: "Failed to contact install server. Please try again later." 回答1: Check if you have Node js already installed before installing meteorjs other wise it crashes on Windows sometimes hope it helped

Knockout.js syntax

♀尐吖头ヾ 提交于 2019-12-12 09:08:07
问题 I am a beginner to the Javascript MVC framework Knockout.js Coming from conventional Javascript (and some jQuery experience), I am having difficulties in understanding the syntax learning Knockout.js Consider the statments below; The View: <ul class="folders" data-bind="foreach: folders"> <li data-bind="text: $data, css: { selected: $data == $root.chosenFolderId() }, click: $root.goToFolder"></li></ul> View Model: function WebmailViewModel() { // Data var self = this; self.folders = ['Inbox',

Button color change when selected

坚强是说给别人听的谎言 提交于 2019-12-12 03:09:10
问题 I have 10 buttons in one HTML page. I want to use JavaScript to change particular button (button 1) color when button is selected. When user click another button (button 2) the color of that button is should change and first selected button (button 1) should be deselected. 回答1: You can define a different CSS class for selected button. .button-selected { border: 2px solid red; } Then when a button is clicked, you can call the function like this: function focusMe(button) { document

Why I can not get the correct value of my <select> field?

此生再无相见时 提交于 2019-12-11 18:08:00
问题 In my index.html , I have a selection drop down menu: <select id="car"> <option value="bmw">BMW</option> <option value="toyota">TOYOTA</option> </select> My js: var c = $('#car'); var selection; c.change(function(){ if(c.val()==='bmw'){ selection = 'BMW'; }else if(c.val()==='toyota'){ selection = 'TOYOTA'; } }); console.log(c.val()); console.log(selection); When page firstly loaded, the initial selection is BMW , and I got console output " BMW " which is fine, then I select " TOYOTA ", but

jquery prevent default seems stuck on and requires additional click

本小妞迷上赌 提交于 2019-12-11 15:36:27
问题 I'm writing a jquery plugin to display a jquery ui dialog when links are clicked to provide a confirmation dialog before the link is followed. The problem i'm having is that when closing the dialog using the "Yes" button, the plugin uses $(element).trigger( 'click' ); to fire the click event on the original anchor element. This does not cause the browser to follow the link, however a second click with my mouse after the dialog closes does work. The plugin is used like this $('a')