그리드 열 표시 / 숨기기시 응답하지 않는 ext-all.js
문제
그리드 열을 표시하거나 숨기려고 할 때 ext-all.js 파일이 중단되는 문제를 해결했습니다.
Mozilla Firefox 25.0에서 ExtJS 4.1.2를 사용하고 있습니다.OS는 Ubuntu 12.10, 그냥 명확하게하기 위해서.
사용자가 플러그인을 통해 행을 편집하면 숨겨진 필드는 사용자가 편집 할 수 있도록 숨겨진 필드 만 표시됩니다.편집이 완료되면 해당 열이 다시 숨겨집니다.
Controller.js :
var hiddenColumns = []; //global array for storing columns
init: function() {
this.control({
...
'myGrid': {
beforeedit: function() {
me.columnsVisibility('show');
},
afterrender: function(){
var me = this,
formDataPanel = me.getFormDataPanel(),
activeGrid = formDataPanel.getLayout().getActiveItem();
for (i=0; i < activeGrid.columns.length; i++) {
if (activeGrid.columns[i].hidden) {
Ext.Array.push(hiddenColumns, activeGrid.columns[i]);
}
}
},
edit: function(editor, e) {
var me = this,
usersStore = me.getStore('Users'),
alias = me.getUserAlias(),
record = usersStore.findRecord('email', alias, false, true, true),
fdupdate = record.get('fdupdate');
me.columnsVisibility('hide');
if (fdupdate == 't') {
try {
e.store.sync();
}
catch (e) { }
e.record.commit();
} else {
var store = me.getStore('Inspection');
store.rejectChanges();
Ext.Msg.alert('Alert!','This function is not currently available for you');
}
},
...
}
});
},
...
columnsVisibility: function(visible){
for (var i=0; i < hiddenColumns.length; i++) {
if (visible == 'hide') {
hiddenColumns[i].hide();
} else if (visible == 'show') {
hiddenColumns[i].show();
}
}
},
...
.
myGrid.js :
initComponent: function() {
var filters = {
ftype: 'filters',
// encode and local configuration options defined previously for easier reuse
encode: false, // json encode the filter query
local: true
},
Ext.apply(this, {
title: 'Inspection',
id: 'inspection', // This is required since title can be changed by filter functions to update status of the grid.
store: 'Inspection',
features: [filters],
selModel: Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }),
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2
})
],
columns: [{
text: 'ID',
width: 35,
dataIndex: 'id'
},{
text: 'Record Name',
dataIndex: 'record_name',
width: 70,//flex: 1,
hidden: true,
editor: {
queryMode: 'local',
displayField: 'record_name',
valueField: 'record_name',
editable: false
},
filter: {
type: 'string'
}
},{
text: 'Date Created',
dataIndex: 'date_created',
width: 150,
filter: {
type: 'string'
}
}]
});
this.callParent(arguments);
}
});
.
내 코드가 의도 한대로 작동하는 동안 스크립트가 사용 중이거나 응답하지 않는 (Script: http://localhost/lib/ext-4.1.2/ext-all.js:18
)
이 문제가 내 버전의 ExtJS, 코드 또는 내 브라우저에 있는지 여부에 대해 불확실합니다.누군가가 도움이 될 수 있다면
해결책
숨기기 및 표시는 DOM 조작 및 후속 브라우저 리플 로우를 조작하는 것에 따라 값 비싼 작업이 될 수 있습니다.몇 개의 행을 위해서는 상당한 지연을 생성하지 않지만 많은 행이 증가 할 수 있으므로 속도가 빨라질 수 있습니다.
나는 lead의 모든 열을 보여주지 않고 숨기지 않고 편집을위한 모든 필드를 포함하는 모든 필드를 포함하는 양식을 가진 별도의 엑스트라 창을 열어 보겠습니다.
제휴하지 않습니다 StackOverflow