1

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

TFS2010 工作项复选框

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

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

4

1 回答 1

2

我已经编写了自己的 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};
});    
于 2014-01-29T13:24:54.420 回答