1
我無法弄清楚如何將數據保存在內聯後重新保存數據 - 我只是通過提供模型類型而獲得了拉力格的工作版本,但我需要將數據在一些我沒有靈活性的情況下更改數據。其他一切都應該發揮作用 - 我遇到的一個問題是將用戶進行的更改保存在隊伍中。來自自定義數據存儲的拉力內聯編輯網格
_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);
}
});
}