扩展Estimation Board:为卡片添加更多属性的技术求助
Hey there! Let's work through this issue step by step—looks like you're close, just a couple of small tweaks needed to get those extra fields showing up on your cards.
First: Fix the Syntax Error in Your Config
The immediate blocker here is a missing comma in your cardboardConfig object. JavaScript object properties require commas to separate them, and you’re missing one after enableRanking: false. That’s why your cardConfig property is being completely ignored by the interpreter.
Here’s the corrected config with the fix:
var cardboardConfig = { types: [], attribute: "PlanEstimate", columns: columns, maxCardsPerColumn: 200, items: that._getItems, sortAscending: true, order: "Rank", enableRanking: false, // Added missing comma here! cardConfig: { fields: ['Iteration', 'ScheduleState']} };
Second: Adjust Field References for Associated Objects
For fields like Iteration (which is a reference to an Iteration object), just specifying Iteration will only display an object reference instead of a readable value. You’ll want to target the specific sub-field you want to show—usually the name:
cardConfig: { fields: ['Iteration.Name', 'ScheduleState']}
Third: Fallback to Custom Card Renderer (If Needed)
Since this is a legacy Estimation Board app, the default cardConfig.fields setting might not always pick up new fields reliably. If the above fixes still don’t work, try overriding the card renderer to explicitly inject your custom fields into the card HTML:
cardConfig: { fields: ['Iteration.Name', 'ScheduleState'], renderer: function(card) { // Keep the default card content first var defaultHtml = card.getDefaultHtml(); // Pull values from the record var iterationName = card.getRecord().get('Iteration') ? card.getRecord().get('Iteration').Name : 'Unassigned'; var scheduleState = card.getRecord().get('ScheduleState') || 'Not Set'; // Append custom fields to the card return defaultHtml + ` <div class="card-custom-field"> <strong>Iteration:</strong> ${iterationName} </div> <div class="card-custom-field"> <strong>Schedule State:</strong> ${scheduleState} </div> `; } }
Add a bit of CSS to style these fields so they fit cleanly on the card:
.card-custom-field { margin: 6px 8px 0; font-size: 12px; color: #555; }
Final Quick Checks
- Double-check field names: Rally uses camelCase, so
ScheduleStateis correct (not "Schedule State"). - Clear your browser cache after making changes—legacy Rally apps often cache old code.
Hope this gets your card fields displaying as expected!
内容的提问来源于stack exchange,提问作者Jake Friedman

