Виджеты ExtJS и процессоры

Здраствуйте сообщество MODx revo. Сталкнулся с проблемой такого рода:
Не срабатывают события на Обновление и Удаление элемента таблицы.
Разрабатываю дополнение, исправно шел по инструкции Василия по разработке Sendex.
Мой компонент состоит из нескольких вкладок на главной странице. Первая выводит необходимую мне кастомную таблицу! а также обрабатывает вызовы (Создать новый, обновить, удалить).
Дополнил home.grid.js следующим табом, повторил операцию, подключил js-ы и вот тут засада:

Таб грузит необходимый контент, но не срабатывает событие (удалить запись, обновить) но при двойном клике Срабатывает обновить и выводит окно обновить соответствующую запись.

Проверял, и перепроверял, изначально взял последний релиз MODx 2.4.

В логе никаких ошибок не выводит.

код привожу ниже:
(Если необходимо смогу вывести home.grid.js и home.class.php но так как вкладки отображаются склоняюсь в сторону проблемы с item.windows.js или item.grid.js)

1. types.grid.js
Jobs.grid.Types = function (config) {
	config = config || {};
	if (!config.id) {
		config.id = 'jobs-grid-types';
	}
	Ext.applyIf(config, {
		url: Jobs.config.connector_url,
		fields: this.getFields(config),
		columns: this.getColumns(config),
		tbar: this.getTopBar(config),
		sm: new Ext.grid.CheckboxSelectionModel(),
		baseParams: {
			action: 'mgr/type/getlist'
		},
		listeners: {
			rowDblClick: function (grid, rowIndex, e) {
				var row = grid.store.getAt(rowIndex);
				this.updateType(grid, e, row);
			}
		},
		viewConfig: {
			forceFit: true,
			enableRowBody: true,
			autoFill: true,
			showPreview: true,
			scrollOffset: 0,
			getRowClass: function (rec, ri, p) {
				return !rec.data.active
					? 'jobs-grid-row-disabled'
					: '';
			}
		},
		paging: true,
		remoteSort: true,
		autoHeight: true,
	});
	Jobs.grid.Types.superclass.constructor.call(this, config);

	// Clear selection on grid refresh
	this.store.on('load', function () {
		if (this._getSelectedIds().length) {
			this.getSelectionModel().clearSelections();
		}
	}, this);
};
Ext.extend(Jobs.grid.Types, MODx.grid.Grid, {
	windows: {},

	getMenu: function (grid, rowIndex) {
		var ids = this._getSelectedIds();

		var row = grid.getStore().getAt(rowIndex);
		var menu = Jobs.utils.getMenu(row.data['actions'], this, ids);

		this.addContextMenuType(menu);
	},

	createType: function (btn, e) {
		var w = MODx.load({
			xtype: 'jobs-type-window-create',
			id: Ext.id(),
			listeners: {
				success: {
					fn: function () {
						this.refresh();
					}, scope: this
				}
			}
		});
		w.reset();
		w.setValues({active: true});
		w.show(e.target);
	},

	updateType: function (btn, e, row) {
		if (typeof(row) != 'undefined') {
			this.menu.record = row.data;
		}
		else if (!this.menu.record) {
			return false;
		}
		var id = this.menu.record.id;

		MODx.Ajax.request({
			url: this.config.url,
			params: {
				action: 'mgr/type/get',
				id: id
			},
			listeners: {
				success: {
					fn: function ® {
						var w = MODx.load({
							xtype: 'jobs-type-window-update',
							id: Ext.id(),
							record: r,
							listeners: {
								success: {
									fn: function () {
										this.refresh();
									}, scope: this
								}
							}
						});
						w.reset();
						w.setValues(r.object);
						w.show(e.target);
					}, scope: this
				}
			}
		});
	},

	removeType: function (act, btn, e) {
		var ids = this._getSelectedIds();
		if (!ids.length) {
			return false;
		}
		MODx.msg.confirm({
			title: ids.length > 1
				? _('jobs_items_remove')
				: _('jobs_item_remove'),
			text: ids.length > 1
				? _('jobs_items_remove_confirm')
				: _('jobs_item_remove_confirm'),
			url: this.config.url,
			params: {
				action: 'mgr/type/remove',
				ids: Ext.util.JSON.encode(ids),
			},
			listeners: {
				success: {
					fn: function ® {
						this.refresh();
					}, scope: this
				}
			}
		});
		return true;
	},

	disableType: function (act, btn, e) {
		var ids = this._getSelectedIds();
		if (!ids.length) {
			return false;
		}
		MODx.Ajax.request({
			url: this.config.url,
			params: {
				action: 'mgr/item/disable',
				ids: Ext.util.JSON.encode(ids),
			},
			listeners: {
				success: {
					fn: function () {
						this.refresh();
					}, scope: this
				}
			}
		})
	},

	enableType: function (act, btn, e) {
		var ids = this._getSelectedIds();
		if (!ids.length) {
			return false;
		}
		MODx.Ajax.request({
			url: this.config.url,
			params: {
				action: 'mgr/type/enable',
				ids: Ext.util.JSON.encode(ids),
			},
			listeners: {
				success: {
					fn: function () {
						this.refresh();
					}, scope: this
				}
			}
		})
	},

	getFields: function (config) {
		return ['id', 'title', 'description', 'actions'];
	},

	getColumns: function (config) {
		return [{
			header: _('jobs_item_id'),
			dataIndex: 'id',
			sortable: true,
			width: 70
		}, {
			header: _('jobs_item_title'),
			dataIndex: 'title',
			sortable: true,
			width: 200,
		}, {
			header: _('jobs_item_description'),
			dataIndex: 'description',
			sortable: false,
			width: 250,
		}, {
			header: _('jobs_grid_actions'),
			dataIndex: 'actions',
			renderer: Jobs.utils.renderActions,
			sortable: false,
			width: 100,
			id: 'actions'
		}];
	},

	getTopBar: function (config) {
		return [{
			text: '<i class="icon icon-plus"></i> ' + _('jobs_btn_create'),
			handler: this.createType,
			scope: this
		}, '->', {
			xtype: 'textfield',
			name: 'query',
			width: 200,
			id: config.id + '-search-field',
			emptyText: _('jobs_grid_search'),
			listeners: {
				render: {
					fn: function (tf) {
						tf.getEl().addKeyListener(Ext.EventObject.ENTER, function () {
							this._doSearch(tf);
						}, this);
					}, scope: this
				}
			}
		}, {
			xtype: 'button',
			id: config.id + '-search-clear',
			text: '<i class="icon icon-times"></i>',
			listeners: {
				click: {fn: this._clearSearch, scope: this}
			}
		}];
	},

	onClick: function (e) {
		var elem = e.getTarget();
		if (elem.nodeName == 'BUTTON') {
			var row = this.getSelectionModel().getSelected();
			if (typeof(row) != 'undefined') {
				var action = elem.getAttribute('action');
				if (action == 'showMenu') {
					var ri = this.getStore().find('id', row.id);
					return this._showMenu(this, ri, e);
				}
				else if (typeof this[action] === 'function') {
					this.menu.record = row.data;
					return this[action](this, e);
				}
			}
		}
		return this.processEvent('click', e);
	},

	_getSelectedIds: function () {
		var ids = [];
		var selected = this.getSelectionModel().getSelections();

		for (var i in selected) {
			if (!selected.hasOwnProperty(i)) {
				continue;
			}
			ids.push(selected[i]['id']);
		}

		return ids;
	},

	_doSearch: function (tf, nv, ov) {
		this.getStore().baseParams.query = tf.getValue();
		this.getBottomToolbar().changePage(1);
		this.refresh();
	},

	_clearSearch: function (btn, e) {
		this.getStore().baseParams.query = '';
		Ext.getCmp(this.config.id + '-search-field').setValue('');
		this.getBottomToolbar().changePage(1);
		this.refresh();
	}
});
Ext.reg('jobs-grid-types', Jobs.grid.Types);

2. types.windows.js
Jobs.window.CreateType = function (config) {
	config = config || {};
	if (!config.id) {
		config.id = 'jobs-type-window-create';
	}
	Ext.applyIf(config, {
		title: _('jobs_item_create'),
		width: 550,
		autoHeight: true,
		url: Jobs.config.connector_url,
		action: 'mgr/type/create',
		fields: this.getFields(config),
		keys: [{
			key: Ext.EventObject.ENTER, shift: true, fn: function () {
				this.submit()
			}, scope: this
		}]
	});
	Jobs.window.CreateType.superclass.constructor.call(this, config);
};
Ext.extend(Jobs.window.CreateType, MODx.Window, {

	getFields: function (config) {
		return [{
			xtype: 'textfield',
			fieldLabel: _('jobs_item_title'),
			name: 'title',
			id: config.id + '-title',
			anchor: '99%',
			allowBlank: false,
		}, {
			xtype: 'textarea',
			fieldLabel: _('jobs_item_description'),
			name: 'description',
			id: config.id + '-description',
			height: 150,
			anchor: '99%'
		}];
	},

	loadDropZones: function() {
	}

});
Ext.reg('jobs-type-window-create', Jobs.window.CreateType);


Jobs.window.UpdateType = function (config) {
	config = config || {};
	if (!config.id) {
		config.id = 'jobs-type-window-update';
	}
	Ext.applyIf(config, {
		title: _('jobs_item_update'),
		width: 550,
		autoHeight: true,
		url: Jobs.config.connector_url,
		action: 'mgr/type/update',
		fields: this.getFields(config),
		keys: [{
			key: Ext.EventObject.ENTER, shift: true, fn: function () {
				this.submit()
			}, scope: this
		}]
	});
	Jobs.window.UpdateType.superclass.constructor.call(this, config);
};
Ext.extend(Jobs.window.UpdateType, MODx.Window, {

	getFields: function (config) {
		return [{
			xtype: 'hidden',
			name: 'id',
			id: config.id + '-id',
		}, {
			xtype: 'textfield',
			fieldLabel: _('jobs_item_title'),
			name: 'title',
			id: config.id + '-title',
			anchor: '99%',
			allowBlank: false,
		}, {
			xtype: 'textarea',
			fieldLabel: _('jobs_item_description'),
			name: 'description',
			id: config.id + '-description',
			anchor: '99%',
			height: 150,
		}];
	},

	loadDropZones: function() {
	}

});
Ext.reg('jobs-type-window-update', Jobs.window.UpdateType);
Сергей Леоненко
20 апреля 2016, 02:37
modx.pro
2 891
0

Комментарии: 2

Володя
20 апреля 2016, 07:35
1
+1
привет, проверь actions в getlist процессоре.
    Сергей Леоненко
    20 апреля 2016, 07:46
    0
    Спасибо, прочекал, были высталенны на дефолтные значения. Поменял и поплыл дальше. Спасибо за оперативность.
      Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
      2