如何電網編輯ExtJS的6.2.0後,只有一排發送到DB?如何只有一排發送到DB網編輯後的ExtJS 6.2.0
後,我連續一個編輯的單元格,素文字比我之前編輯發送到服務器的所有行。 但我還想向服務器發送一個只有一排,其中i編輯的細胞。 如何做到這一點? He is a json to server
Ext.require(['Ext.data.*', 'Ext.grid.*']);
Ext.util.Format.timefieldRenderer = function(format) {
return function(v) {
if (v instanceof Date) {
return v.format(format);
} else {
return v;
}
};
};
// Создаем model
Ext.define('Users', {
extend: 'Ext.data.Model',
fields: [{
name: 'id',
type: 'int'
},
{
name: 'time',
type: 'date',
//dateFormat: 'H:i'
},
]
});
var occupationStore = Ext.create('Ext.data.Store', {
fields: ['time'],
data: [{
time: 'CEO'
},
{
time: 'Vicepresident'
},
{
time: 'Marketing manager'
},
]
});
Ext.onReady(function() {
// Создаем store
var store = Ext.create('Ext.data.Store', {
autoLoad: true,
autoSync: true,
model: 'Users',
proxy: {
type: 'ajax',
url: 'server.php',
api: {
read: 'server.php?action=read',
update: 'server.php?action=update'
},
reader: {
type: 'json',
rootProperty: 'data'
},
writer: {
type: 'json',
encode: true,
rootProperty: 'dataUpdate',
allowSingle: false,
writeAllFields: true,
//root:'records'
},
actionMethods: {
read: 'GET',
update: 'GET'
}
},
}
);
var grid = Ext.create('Ext.grid.Panel', {
renderTo: document.body,
//plugins: [rowEditing],
// Редактирование
plugins: {
ptype: 'cellediting',
clicksToEdit: 1
},
width: 1000,
height: 330,
frame: true,
title: 'Users',
store: store,
iconCls: 'icon-user',
columns: [{
text: 'id',
width: 50,
sortable: true,
dataIndex: 'id',
renderer: function(v, meta, rec) {
return rec.phantom ? '' : v;
}
},
{
header: 'time',
width: 120,
// sortable: true,
dataIndex: 'time_start',
//format: 'H:i',
// Нужно для верного отображеия времени после редактирования в таблице
renderer: Ext.util.Format.dateRenderer('H:i'),
editor: {
completeOnEnter: false,
field: {
xtype: 'timefield',
format: 'H:i',
//name: 'timeStart1',
//fieldLabel: 'Time In',
minValue: '8:00',
maxValue: '20:00',
increment: 30,
anchor: '100%',
allowBlank: false
}
}
},
],
});
});
應該發生什麼其他行?你想最終發送給服務器嗎?網格應該如何知道要發送哪些行?請詳細說明。 – Alexander
其他行應該發生什麼? - 沒有。你最終想把它們發送到服務器嗎? - 是的。網格應該如何知道要發送哪些行? - 我不知道.. – Masquitos
如果你不知道送哪行,然後不問電腦或計算器知道它。計算機完成程序員告訴他的任何事情,而且計算器可以幫助將您的想法轉化爲計算機語言。 – Alexander