是否有可用于TFS 2012工作项的复选框控件?我找到了TFS 2010的那个,但由于某种原因它不适用于2012年。
TFS2010工作项复选框
我真的不明白为什么工作项模板中尚未实现复选框控件..
答案 0 :(得分: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};
});