我无法弄清楚如何在内联编辑后将数据保存回拉力赛 - 我只是通过提供模型类型来获得一个带拉力网的工作版本,但我需要在某些情况下聚合和更改数据没有灵活性。其他一切都应该有效 - 我遇到的一个问题就是保存用户在线回复的变化。
_createGrid: function(start, end, type, filterConfig) {
App._newGrid(start, end, type, {
filters : filterConfig,
fetch : ['FormattedID', 'Name', 'Description', 'Notes', 'Owner', 'PlannedStartDate', 'PlannedEndDate', 'c_WINListState', 'c_Department', 'Parent']
}, true, filterConfig);
},
_newGrid: function(start, end, type, config, normalGrid, filterConfig) {
Ext.define('WinState', {
extend: 'Ext.data.Model',
fields: [
{name: 'value', type: 'string'}
]
});
var dataStore = Ext.create('Ext.data.Store', {
model: 'WinState',
data : [
{value : "Off Track"},
{value : "At Risk"},
{value : "On Track"},
{value : "Complete"}
]
});
Ext.define('StateEditor', {
extend : 'Ext.form.field.ComboBox',
xtype : 'stateeditor',
displayField : 'value',
store : dataStore,
queryMode : 'local'
});
Ext.define('Department', {
extend: 'Ext.data.Model',
fields: [
{name: 'value', type: 'string'}
]
});
var deptStore = Ext.create('Ext.data.Store', {
model: 'Department',
data : [
{value: "x"},
{value: "y"},
{value: "z"},
]
});
Ext.define('DepartmentEditor', {
extend : 'Ext.form.field.ComboBox',
xtype : 'depteditor',
displayField : 'value',
store : deptStore,
queryMode : 'local'
});
var gridId;
if (normalGrid) {
gridId = 'dataGrid';
} else {
gridId = 'detailGrid';
}
var parseData = [];
Ext.create('Rally.data.WsapiDataStore', {
model : type,
limit : Infinity,
filters : filterConfig,
fetch : ['Name', 'FormattedID', 'PlannedStartDate', 'PlannedEndDate', 'Notes', 'Parent', 'Description', 'c_WINListState', 'c_Department', 'Owner']
}).load({
callback : function(store) {
Ext.Array.each(store.getItems(), function(item) {
var winOrder;
var owner;
if (item.Owner) {
owner = item.Owner._refObjectName;
} else {
owner = '';
}
var state;
if (item.c_WINListState) {
state = item.c_WINListState;
} else {
state = '';
}
parseData.push({
Parent : '' + winOrder,
Name : '' + item.Name,
ID : '' + item.FormattedID,
Scope : '' + App._getSpan(new Date(item.PlannedStartDate), new Date(item.PlannedEndDate)),
Notes : '' + item.Notes,
Description : '' + item.Description,
WINListState : '' + state,
Department : '' + item.c_Department,
Owner : '' + owner
});
});
App.grid = App.down('#displayArea').add({
xtype : 'rallygrid',
id : 'fullGrid',
disableSelection : true,
showPagingToolbar : false,
enableEditing : true,
store : Ext.create('Rally.data.custom.Store', {
data : parseData,
pageSize : 1000000,
autoLoad : true
}),
columnCfgs: [
{text: 'ID', dataIndex: 'ID', flex: 1},
{text: 'Name', dataIndex: 'Name', flex: 2},
{text: 'Notes', dataIndex: 'Notes', flex: 3},
{text: 'Description', dataIndex: 'Description', flex: 3, editor: 'rallytextfield'},
{text: 'Scope', dataIndex: 'Scope', flex: 1},
{text: 'State', dataIndex: 'WINListState', flex: 1, editor: 'stateeditor'},
{text: 'Department', dataIndex: 'Department', flex: 2, editor: 'depteditor'},
{text: 'Owner', dataIndex: 'Owner', flex: 1}
]
});
console.log('parseData',parseData);
}
});
}