我创建了一个 Rally.ui.AddNew 按钮来添加新版本。
如果用户点击“添加详细信息”(这是发布的唯一活动按钮,您无法添加没有详细信息的发布)我希望在打开对话框时默认设置某些字段。
例如,我想设置“在所有子项目中创建匹配的版本”复选框(如果存在),我想在“注释”区域放置一个默认注释。
我怎么做?如果出现详细信息对话框,则看起来不会调用侦听器“beforecreate”或“create”。
理想情况下,我还希望有机会在创建项目之前与另一个听众再次检查这些项目。这些听众存在吗?
我创建了一个 Rally.ui.AddNew 按钮来添加新版本。
如果用户点击“添加详细信息”(这是发布的唯一活动按钮,您无法添加没有详细信息的发布)我希望在打开对话框时默认设置某些字段。
例如,我想设置“在所有子项目中创建匹配的版本”复选框(如果存在),我想在“注释”区域放置一个默认注释。
我怎么做?如果出现详细信息对话框,则看起来不会调用侦听器“beforecreate”或“create”。
理想情况下,我还希望有机会在创建项目之前与另一个听众再次检查这些项目。这些听众存在吗?
The Rally standard editor likely provides only limited capabilities for defaulting field values when instantiated. As an indication, AppSDK1 had the rally.sdk.util.Navigation.popupCreatePage() method, which would accept an object with default values, for example:
// Open Defect editor with Defect default-associated to User Story with OID 12345
rally.sdk.util.Navigation.popupCreatePage("defect", {requirementOid: 12345});
The default key/value pairs that this method accepts were not well-documented. One of Rally's UI Engineers provided me with this list at one time:
rally.sdk.util.Navigation.popupCreatePage defaults keys
User Story:
defaultName
rank
iteration
release
parent
dpyOid {dependency}
Defect:
defaultName
defectSuiteOid {Defect Suites}
testCaseResult
testCase
requirement
iteration
Defect Suite:
defaultName
rank
iteration
Portfolio Item:
defaultName
rank
parent
Task:
workProduct
Test Case:
testfolderOid {Test Folder}
artifactOid {Artifact}
Test Set:
iteration
release
While the above list may not be exhaustive (or even completely accurate anymore), it suggests that the allowed defaults for the standard Rally Editor may not include the "Create matching Releases in all child projects" checkbox or the Notes field.
Nonetheless, it's not immediately apparent to me that there is any method or config for AppSDK2's Rally.ui.AddNew that is an analog in functionality to AppSDK1's rally.sdk.util.Navigation.popupCreatePage() ability to setup default values into the resulting Editor window. Hopefully one of Rally's UI Engineers may have better information to add to this question.
Unfortunately for now not all the built-in fields are defaultable (see Mark W's answer above for the list of pre-fillable fields). Any custom fields are though. You'll want to check out the beforeeditorshow event. You can modify the params there.
addNewComponent.on('beforeeditorshow', function(addNew, params) {
params.defaultName = 'foo';
params.c_MyField = 'bar';
});
Note that if you would just like to create or edit objects you can directly call the methods on Rally.nav.Manager.