TFS 2012 工作项模板复选框



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

TFS2010"工作项"复选框

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

我真的不明白为什么尚未在工作项模板中实现复选框控件。

我编写了自己的复选框自定义控件:

清单.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};
});    

最新更新