3 개의 열이있는 그리드를 만들고 싶습니다. 한 열은 'textfield'이고 다른 두 열은 'filefield'로 편집기를 설정 한 이미지입니다. 이미지 열에서 렌더러를 사용하여 이미지를 표시 할 수 있지만 이미지를 편집하거나 추가 할 때 찾아보기 버튼을 눌러 이미지를 탐색 할 수 없습니다. 여기 내 코드가있다.ExtJS4 - Grid에 파일 업로드 편집기를 추가하는 방법은 무엇입니까?
var grid = Ext.create('Ext.grid.Panel', {
title: 'Author',
store: Ext.data.StoreManager.lookup('authorStore'),
renderTo: 'authorGrid',
columns: [{
header: 'Name',
dataIndex: 'name',
editor: {
xtype: 'textfield',
}
}, {
header: 'Icon',
dataIndex: 'iconImage',
renderer: function(val) {
return '<img src="' + val + '">';
},
editor: {
xtype: 'filefield',
allowBlank: false,
}
}, {
header: 'Background',
dataIndex: 'background',
renderer: function(val) {
return '<img src="' + val + '">';
},
editor: {
xtype: 'filefield',
allowBlank: false,
}
}],
selModel: Ext.create('Ext.selection.CheckboxModel'),
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 2
})
],
tbar: [{
iconCls: 'icon-add',
text: 'Add',
handler: function() {
// add record
}
}, {
iconCls: 'icon-delete',
text: 'Remove',
handler: function() {
// remove selected records...
}
}, {
iconCls: 'icon-save',
text: 'Save',
handler: function() {
store.save();
}
}]
});
무엇이 잘못 되었나요? 이렇게 'filefield'편집기를 넣을 수 있습니까? 그리드 데이터 저장 및 이미지 업로드를 위해 그리드의 저장 버튼을 클릭 할 수 있습니까?
감사합니다. innerJL! 귀하의 접근 방식은 필자의 요구 사항을 해결합니다. –