var window = Gikam.create('window', {
renderTo: document.body
});
Gikam.create('layout', {
renderTo: window.$dom,
center: {
items: [{
type: 'tab',
fill: true,
panels: [{
title: '表格事件',
items: [{
type: 'grid',
id: 'grid',
checkOnActive: false,
url: IFM_CONTEXT + '/core/module/item/files/queries',
columns: [{
checkbox: true
}, {
field: 'targetId',
title: '编码',
editor: 'true',
type: 'link',
}, {
field: 'name',
editor: 'true',
title: '名称'
}, {
field: 'fileExt',
editor: 'true',
title: '描述',
}],
onLoadSuccess: function (data) {
// 表格只读.(setReadonly方法放入onLoadSuccess事件,会不停的发送查询请求,导致表格加载不出数据.)
Gikam.getComp('grid').setReadonly(true);
},
toolbar: [{
type: 'button',
text: '设为只读',
icon: 'refresh',
onClick: function () {
Gikam.getComp('grid').setReadonly(true);
}
}, {
type: 'button',
text: '设为可编辑',
icon: 'refresh',
onClick: function () {
Gikam.getComp('grid').setReadonly(false);
}
}]
}]
}]
}]
}
});
console