下面是我的代码,显示grid
使用rallygrid
这一切都很好,但我想要一个column
薪水可编辑尝试了一些建议,但没有任何对我有用。
我正在使用Rally sdk /apps/2.0/sdk.js"
_draw_grid: function(newHash, committedData) {
acceptedPoints = {};
Ext.Array.each(committedData, function(cData){
if ( ! acceptedPoints[cData.ProjectName] ) { acceptedPoints[cData.ProjectName] = 0; }
acceptedPoints[cData.ProjectName] = cData.Accept;
});
summaryHash = {};
_.each(projects, function(team) {
if (!summaryHash[team] && newHash[team]) {
summaryHash[team] = {
Name: team,
Count: newHash[team].length,
Days: 10,
Points: acceptedPoints[team],
Salary: "$200,000"
};
};
});
records = [];
Ext.Object.each(summaryHash, function(key, value) {
if (newHash[key]) {
records.push(value);
}
});
this.records = records;
var cfgsValues = [];
cfgsValues.push({text: 'Teams', style:"background-color: #D2EBC8", dataIndex: 'Name', width: 170, renderer: function(value, meta_data, record, row, col) {
return value;
}});
cfgsValues.push({text: '# Developers', style:"background-color: #D2EBC8", dataIndex: 'Count', width: 70, renderer: function(value, meta_data, record, row, col) {
return value;
}});
cfgsValues.push({text: '# Points', style:"background-color: #D2EBC8", dataIndex: 'Points', width: 70, renderer: function(value, meta_data, record, row, col) {
return value;
}});
cfgsValues.push({text: '# Days in Sprint', style:"background-color: #D2EBC8", dataIndex: 'Days', width: 70, renderer: function(value, meta_data, record, row, col) {
return value;
}});
cfgsValues.push({text: '# Average Salary Cost per Sprint', style:"background-color: #D2EBC8", dataIndex: 'Salary', width: 100, renderer: function(value, meta_data, record, row, col) {
return value;
}});
this.setLoading(false);
self.add({
xtype: 'rallygrid',
bodyBorder: 1,
showPagingToolbar: false,
showRowActionsColumn: false,
enableEditing:true,
editable: true,
selType: 'cellmodel',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
store: Ext.create('Rally.data.custom.Store', {
data: records
}),
columnCfgs: cfgsValues
});
}
});
答案 0 :(得分:1)
您需要将编辑器添加到您想要编辑的任何列中。
尝试更改:
cfgsValues.push({text: '# Average Salary Cost per Sprint', style:"background-color: #D2EBC8", dataIndex: 'Salary', width: 100, renderer: function(value, meta_data, record, row, col) {
return value;
}});
到
cfgsValues.push({text: '# Average Salary Cost per Sprint', style:"background-color: #D2EBC8", dataIndex: 'Salary', width: 100, renderer: function(value, meta_data, record, row, col) {
return value;
},
editor: {
xtype: 'numberfield' // this assumes that salary is a number; if not, set to 'textfield'
}});
查看Ext JS的单元格编辑文档,以便更好地了解如何设置列的格式 http://docs-origin.sencha.com/extjs/4.2.2/#!/api/Ext.grid.plugin.CellEditing