我创建了一个纸板应用程序,它有Backlog并作为标题发布。
每个列都包含该版本的一些功能,但是当我拖动该功能时,我可以更改该功能的版本字段。
但无法更新该专题报道的发布字段。
下面是我的代码,任何建议,帮助@nickm,@ kyle
Ext.override(Rally.ui.cardboard.Column,{
getStoreFilter: function(model) {
var property = this.attribute;
var value = this.getValue();
if ( this.attribute == "Release" ) {
property = "Release.Name";
if ( value ) {
value = value.get('Name');
}
}
return {
property:property,
operator: '=',
value: value
};
},
isMatchingRecord: function(record) {
var recordValue = record.get(this.attribute);
if (recordValue) {
recordValue = recordValue.Name;
}
var columnValue = this.getValue();
if ( columnValue ) {
columnValue = columnValue.get('Name');
}
return (columnValue === recordValue );
},
addCard: function(card, index, highlight) {
var record = card.getRecord();
console.log("record what we want", record);
var project = record.get('Context');
var target_value = this.getValue();
if ( target_value && typeof(target_value.get) === "function" ) {
target_value = this.getValue().get('_ref');
}
//console.log("values to see", record, this.attribute, target_value);
record.set(this.attribute,target_value);
if (target_value) {
this._updateStories(record, project, this.getValue()).then({
success: function(){
console.log("Updated");
},
scope: this
}, this);
record.set("PlannedStartDate",this.getValue().get('ReleaseStartDate'));
record.set("PlannedEndDate",this.getValue().get('ReleaseDate'));
} else {
record.set("PlannedStartDate",null);
record.set("PlannedEndDate",null);
}
if (!Ext.isNumber(index)) {
//find where it should go
var records = Ext.clone(this.getRecords());
records.push(record);
this._sortRecords(records);
var recordIndex = 0;
for (var iIndex = 0, l = records.length; iIndex < l; iIndex++) {
var i = records[iIndex];
if (i.get("ObjectID") === record.get("ObjectID")) {
recordIndex = iIndex;
break;
}
}
index = recordIndex;
}
this._renderCard(card, index);
if (highlight) {
card.highlight();
}
this.fireEvent('addcard');
card.fireEvent('ready', card);
},
_updateStories: function(record, project, releaseVal) {
var deferred = Ext.create('Deft.Deferred');
Ext.create('Rally.data.WsapiDataStore',{
model: 'HierarchicalRequirement',
autoLoad: true,
filters: [
{property:'Feature.ObjectID', value: record.get('ObjectID') },
//{property:'Parent.ObjectID', value: record.get('ObjectID') }
//{property:'DirectChildrenCount',value:0 }
],
context: project,
limit: Infinity,
fetch: ['Name','Release','ObjectID'],
listeners: {
load: function(store, stories, operation) {
Ext.Array.each(stories, function(story) {
console.log(releaseVal); // Release Object
story.Release = releaseVal;
story.save({
callback: function(result, operation) {
console.log("operation", operation);
if(operation.wasSuccessful()) {
console.log("operation", operation);
}
else{
console.log("error");
}
}
});
});
deferred.resolve();
}
}
}, this);
return deferred;
},
答案 0 :(得分:0)
你这样做的地方:
story.Release = releaseVal;
请改为尝试:
story.set('Release', releaseVal);