Приложение отображает дерево.Записи добавляются с помощью плагинов «rowediting».
В контроллере, нажав кнопку «Создать», запускается событие.
...
onAddChild: function(el) {
var grid = el.up('treepanel'),
sel = grid.getSelectionModel().getSelection()[0],
store = grid.getStore();
store.suspendAutoSync()
var child = sel.appendChild({
text: '',
leaf: true
});
sel.expand()
grid.getView().editingPlugin.startEdit(child);
store.resumeAutoSync();
},
...
Сам плагин выглядит так:
plugins: [{
ptype: 'rowediting',
clicksToMoveEditor: 1,
autoCancel: false,
listeners: {
afteredit: function (editor, context, eOpts) {
context.store.reload();
},
canceledit: function (editor, context, eOpts) {
context.store.reload();
},
beforeedit: function (editor, context) {
return !context.record.isRoot();
}
}
}],
Store:
Ext.define('Survey.store.QuestionTreeStore', {
extend: 'Ext.data.TreeStore',
model: 'Survey.model.QuestionTree',
autoLoad: true,
autoSync: true,
//storeId: 'QuestionTree',
proxy: {
type: 'ajax',
noCache: false,
api: {
create: urlRoot + 'Create',
update: urlRoot + 'Update',
destroy: urlRoot + 'Destroy',
read: urlRoot + 'Read'
},
Проблема в том, что добавление записи происходит, но в то же время она не отображается в дереве, мне нужно обновить страницу так, чтобызапись появится.Как сделать так, чтобы новая запись сразу появилась в дереве?
Спасибо