У меня проблема с Ext.Grid.EditorGridPanel, в настоящее время я использую ExtJS 2.3.0, которую нельзя изменить. : - (
После проблемы:
Я создал окно, которое состоит из 2 FormPanel и между ними EditorGridPanel.
Для viewConfig сетки установлено только «forceFit = true», а для ColumnModel не заданы параметры стиля или представления.
Только для каждого столбца опция выравнивания установлена на «центр».
ColumnModel состоит из 13 столбцов, более или менее текстовых.
Теперь я открываю веб-сайт, над которым я работаю, с помощью браузера и открываю окно для проверки графического интерфейса.
Когда я пытаюсь переключаться между ячейками в одной строке, вся строка данных перемещается влево,
так что первые ячейки больше не отображаются.
После добавления новой строки в сетку (с помощью кнопки добавления) вид сбрасывается, и все ячейки для каждого столбца снова отображаются правильно.
Заголовки столбцов и tbar фиксированы и всегда корректно отображаются.
Проблема возникает с IExplorer 8.0x, более старой версией Firefox (2.0x), но сетка отлично работает с Firefox 3.6x и Safari 5.0x.
Если кто-то сталкивался с подобной проблемой и решил ее, или подумал, что может вызвать эту проблему, смело отвечайте. ;-)
Спасибо заранее!
[править]
Спасибо за комментарий, здесь какой-то измененный источник из полного источника:
getTypeSelectionGrid: function() {
this.gridRecord: Ext.data.Record.create([
{name:'id', type:'int'},
{name:'start', type:'string'},
{name:'end', type:'string'},
{name:'mo', type:'boolean'},
{name:'tu', type:'boolean'},
{name:'we', type:'boolean'},
{name:'th', type:'boolean'},
{name:'fr', type:'boolean'},
{name:'sa', type:'boolean'},
{name:'su', type:'boolean'},
{name:'type', type:'string'}
]);
this.gridStore = new Ext.data.Store({
baseParams: {
},
sortInfo: {field: 'id', direction: 'ASC'},
proxy: new Ext.data.HttpProxy({
url: '',
method: 'post'
}),
reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'totalCount',
id: 'id'
}, this.gridRecord)
});
var sm = new Ext.grid.RowSelectionModel({ singleSelect: true });
var columnConfig = [];
//auto incremented id column
columnConfig.push({
header: 'id',
dataIndex: 'id',
width: 50,
editor: new Ext.form.TextField({
anchor: '100%',
allowBlank: false,
disabled: true
})
});
//start value for time range, values from '00:00' to '24:00' steps by second, here shorted to 2 options
columnConfig.push({
header: 'start',
dataIndex: 'start',
width: 70,
align: 'center',
editor: new Ext.form.ComboBox({
store: new Ext.data.SimpleStore({
fields: ['val', 'txt'],
data : [['00:00', '00:00'],['24:00', '24:00']]
}),
displayField: 'txt',
valueField: 'val',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
saveRouting: true,
forceSelection: true,
anchor: '100%',
allowBlank: false
})
});
//same as above for end of time range, dataIndex 'end'
//now 7 checkbox columns foreach weekday
columnConfig.push({
xtype: 'checkcolumn',
header: 'mo',
dataIndex: 'mo',
align: 'center',
width: 30
}));
//same as above for dataIndex 'tu', 'we', 'th', 'fr', 'sa' and 'su'
//here simplified to SimpleStore, originally a remote store which gets the data
//by a HttpProxy
columnConfig.push({
header: 'type',
dataIndex: 'type',
editor: new Ext.form.ComboBox({
store: new Ext.data.SimpleStore({
fields: ['val', 'txt'],
data : [[1, 'type 1'],[2, 'type 2']]
}),
displayField: 'txt',
valueField: 'txt',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
saveRouting: true,
forceSelection: true,
anchor: '100%',
allowBlank: false
})
});
//then 2 plugins which have some functionality for the selected row
//grid tested with and without both plugins, they are not the cause
var cm = new Ext.grid.ColumnModel(columnConfig);
cm.defaultSortable = false;
//now the grid
this.typeSelectionGrid = new Ext.grid.EditorGridPanel({
store: this.gridStore,
clicksToEdit: 1,
autoHeight: true,
cm: cm,
sm: sm,
viewConfig: {
forceFit: true
},
tbar: [{
text: 'add new row',
cls: 'x-btn-text',
scope: this,
handler: function(){
//adds a row with incremented id
}
}],
listeners: {
scope: this,
show: function() {
sm.selectFirstRow.defer(1000, selectionModel);
}
}
});
return this.typeSelectionGrid;
},
//the grid is then inserted between the Panels into the window component
//looks something like that
render: function() {
var layoutFn = function(pnl) {
pnl.ownerCt.ownerCt.doLayout.defer(Ext.isIE ? 300 : 0, pnl.ownerCt.ownerCt);
pnl.doLayout.defer(Ext.isIE ? 500 : 200, pnl);
};
this.cardLayout.add({
layout: 'border',
border: false,
bodyStyle: 'background-color: #fff',
items: [
{
region: 'center',
border: false,
layout: 'column',
autoScroll: true,
defaults: {
columnWidth: 1,
bodyStyle: 'padding: 5px;',
border: false,
autoHeight: true,
layout: 'column',
defaults: {
columnWidth: 1
}
},
items: [
//first Ext.form.FormPanel with some TextFields
{
items: {
listeners: {
expand: layoutFn,
collapse: layoutFn
},
frame: true,
title: 'panel with a grid',
collapsible: true,
titleCollapse: true,
layout: 'fit',
autoHeight: true,
items: this.getTypeSelectionGrid()
}
}
//second Ext.form.FormPanel with some TextFields
]
}
]
});
}