【问题标题】:TFS 2012 Work Item Template CheckboxTFS 2012 工作项模板复选框
【发布时间】:2013-09-23 00:09:16
【问题描述】:

是否有可用于 TFS 2012 工作项的复选框控件?我找到了适用于 TFS 2010 的那个,但由于某种原因它不适用于 2012。

TFS2010 工作项复选框

http://social.msdn.microsoft.com/Forums/vstudio/en-US/7e6ee51f-31f9-4859-8e9b-e081400576d7/tfs2010-workitem-checkbox-control

我真的不明白为什么工作项模板中还没有实现复选框控件..

【问题讨论】:

    标签: c# checkbox tfs azure-devops workitem


    【解决方案1】:

    我已经编写了自己的 Checkbox 自定义控件:

    manifest.xml 文件内容:

    <WebAccess version="12.0">
      <plugin name="AzCheckBox Custom Control" vendor="vendorName" moreinfo="http://www.vendorName.be/" version="1.1.1.0" >
        <modules>
          <module namespace="AzCheckBox" kind="TFS.WorkItem.CustomControl"/>
        </modules>
      </plugin>
    </WebAccess>
    

    AzCheckBox.js 文件内容:

    // Register this module as "AzCheckBox" and declare 
    // dependencies on TFS.WorkItemTracking.Controls, TFS.WorkItemTr
    TFS.module("AzCheckBox",
        [
            "TFS.WorkItemTracking.Controls",
            "TFS.WorkItemTracking",
            "TFS.Core"
        ],
        function () {
    
            // module content
            var WITOM = TFS.WorkItemTracking,
                WITCONTROLS = TFS.WorkItemTracking.Controls,
                delegate = TFS.Core.delegate;
    
    
            // Constructor for AzCheckBox
            function AzCheckBox(container, options, workItemType) {
                this.baseConstructor.call(this, container, options, workItemType);
            }
    
            AzCheckBox.inherit(WITCONTROLS.WorkItemControl, {
            _control:null, 
    
            _init: function () {
                this._base();
                this._control = $("<input type='checkbox' >").appendTo(this._container).bind("change", delegate(this, this.onChanged));
                },
    
            invalidate : function (flushing, field) {
                if(this._workItemControl.isReadOnly()) {
                    this._control.attr("disabled", "disabled");
                } else {
                    this._control.removeAttr("disabled");
                }
                this._control.attr("checked", field.getValue());
            },
    
            getValue : function () {
                return this._control.attr("checked") ? true : false;
            },
    
            clear : function () {
                this._control.attr("checked", false);
            },
    
            onChanged : function (e) {
                this._workItemControl._getField().setValue(this.getValue());
            },
        });
    
        WITCONTROLS.registerWorkItemControl("AzCheckBox", AzCheckBox);
            return {AzCheckBox: AzCheckBox};
    });    
    

    【讨论】:

      猜你喜欢
      • 2015-06-20
      • 2012-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-17
      • 2013-05-07
      • 2013-01-22
      相关资源
      最近更新 更多