小编FMM*_*FMM的帖子

使用jQuery Mobile + knockout.js初始化"检查"单选按钮的状态

我似乎无法弄清楚为什么我的UI的初始状态没有状态中的第一个单选按钮'checked'.这是一个jsFiddle:http://jsfiddle.net/floyd_may/JcTxT/

但是,这个jsFiddle在这里运行得很好,即使你修改它以将其更改为radio输入(而不是checkbox):http://jsfiddle.net/rniemeyer/EGAH9/

你开始想,也许jQuery Mobile可以在这一切中发挥作用; 然而,我的原始小提琴的这个版本已经删除了jQuery Mobile部分,但仍然不起作用:http://jsfiddle.net/floyd_may/JcTxT/5/

为什么"儿童1"单选按钮最初没出现checked

jquery-mobile knockout.js

4
推荐指数
1
解决办法
1333
查看次数

通过由基类c#实现的接口调用类的方法

我有这段代码,但我听不懂。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1 {
    interface IStoreable {
        void Read();
        void Write();
    }
    class Person : IStoreable {
        public virtual void Read() { Console.WriteLine("Person.Read()"); }
        public void Write() { Console.WriteLine("Person.Write()"); }
    }
    class Student : Person {
        public override void Read() { Console.WriteLine("Student.Read()"); }
        public new void Write() { Console.WriteLine("Student.Write()"); }
    }
    class Demo {
        static void Main(string[] args) {
            Person s1 = new Student();
            IStoreable isStudent1 = s1 as IStoreable;

            // 1 …
Run Code Online (Sandbox Code Playgroud)

c# interface base-class derived-class

3
推荐指数
1
解决办法
839
查看次数

具有隔离范围的AngularJS指令 - 我真的必须在任何地方调用$ parent吗?

我有一个angular.js指令来创建一个按钮(悬停类,左右图标等).我正在使用按钮的左右图标的自动绑定,scope: { uiButtonIconLeft: '@', uiButtonIconRight: '@' }以便我可以将这些值绑定到父作用域的数据.但是,这会导致angularjs创建一个"隔离"范围,这意味着在这种情况下使用我的指令不起作用:

<div ng-controller='someController'>
    <a ng-repeat='thing in things'
       ui-button
       ui-button-icon-left='{{thing.icon}}'
       ng-click='someMethodTheControllerPutOnTheScope(thing.id)'
       >
       I don't work, don't bother clicking me
    </a>
</div>
Run Code Online (Sandbox Code Playgroud)

我必须这样做:

<div ng-controller='someController'>
    <a ng-repeat='thing in things'
       ui-button
       ui-button-icon-left='{{thing.icon}}'
       ng-click='$parent.someMethodTheControllerPutOnTheScope($parent.thing.id)'
       >
       Holy leaky abstractions, Batman, it works!
    </a>
</div>
Run Code Online (Sandbox Code Playgroud)

我的问题是:这是惯用的吗?应该这样吗?我做错了吗?我们的英雄可以$parent.<whatever>在他的标记中清除多余的,重复的,恼人的额外内容吗?

编辑

我为我的按钮"小部件"确定的答案是避免使用隔离范围并通过范围观察左右图标的属性值attributes.$observe(...)而不是绑定.

javascript angularjs

3
推荐指数
2
解决办法
8752
查看次数

针对新内容类型和新字段类型的Archetypes vs. Dexterity

我已经离开Plone世界几年了(自从关于Plone 2.5)并且我试图在哪里投入时间来创建新的内容类型,特别是使用新的自定义字段(包括自定义视图)和编辑小部件).

有人能帮助我理解Archetypes和Dexterity之间的决策点吗?我以前写过基于AT的产品,所以我对那里的基础设施有一定的了解.我也在慢慢扫除Zope 3的记忆.一些细节:

  • Dexterity与AT的未来是什么样的?AT会被Dexterity取代吗?如果我写一个基于AT的产品,它最终是否需要移植到Dexterity?

  • 什么为自定义字段类型,自定义窗口小部件和自定义视图提供了更简单的开发人员体验?

  • 如何使用Dexterity部署自定义工作流程?

  • 如何将现有内容从旧版本的产品迁移到较新版本?

谢谢!

python plone

2
推荐指数
1
解决办法
621
查看次数

C#编译器认为应该初始化这些变量

以下是我正在编写的应用程序示例:

        bool x3k = false, y3k = false;

        // all of these functions return nullable ints (int?)
        var comparison = 
            DoSomething(x, y)
            ?? DoSomething2(x, y)
            ?? DoSomething3(x, y, out x3k, out y3k)
            ?? DoSomething4(x, y)
            ?? DoSomething5(x, y);

        if (comparison.HasValue)
            return comparison.Value;

        if (x3k) // compiler error here if I don't init x3k
        {

        }
Run Code Online (Sandbox Code Playgroud)

我不明白,在零合并链中,如果comparison是x3k可以未初始化null,我不会提前返回.这里发生了什么?

c#

1
推荐指数
1
解决办法
114
查看次数