We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20380
    • 118 Posts
    На кнопке висит событие:
    editFiletype : function(btn, e) {
    		
    		var r = {
    			'id' : MODx.request.id,
    			'd' : this.menu.record.i,
    			'key' : this.menu.record.key,
    			'name' : this.menu.record.name,
    			'service' : 'MODX'
    		};
    		if (!this.windows.EditFiletype) {
    			this.windows.EditFiletype = MODx.load({
    				xtype : 'advicles-window-filetypeedit',
    				record : r,
    				listeners : {
    					'success' : {
    						fn : function(r) {
    							this.refresh();
    						},
    						scope : this
    					}
    				}
    			});
    		}
    		this.windows.EditFiletype.setValues(r);
    		this.windows.EditFiletype.show(e.target);
    	},

    Открывается окошко с формой:
    Advicles.window.EditFiletype = function(config) {
    	config = config || {};
    	this.ident = config.ident || 'advimp' + Ext.id();
    	Ext.applyIf(config, {
    		title : "Редактировать тип файлов",
    		id : this.ident,
    		url : "/assets/components/advicles/filetypelist.php",
    		action : 'edit',
    		fields : [{
    			xtype : 'hidden',
    			name : 'id',
    			value : MODx.request.id
    		}, {
    			xtype : 'hidden',
    			name : 'd',
    			value : MODx.request.d
    		}, {
    			xtype : 'textfield',
    			fieldLabel : "Ключ",
    			description : "Латинскими буквами",
    			name : 'key',
    			id : 'modx-filetype-key',
    			value : MODx.request.key
    		}, {
    			xtype : 'textfield',
    			fieldLabel : "Название",
    			name : 'name',
    			id : 'modx-filetype-name',
    			value : MODx.request.name
    		}]
    	});
    	Advicles.window.EditFiletype.superclass.constructor.call(this, config);
    };
    Ext.extend(Advicles.window.EditFiletype, MODx.Window, {
    	activeOptions : 'advicles-options-MODX',
    	changeService : function(cb, s) {
    		var nv = cb.getValue();
    		var op = Ext.getCmp(this.activeOptions);
    
    		var nop = 'advicles-options-' + nv;
    		var p = Ext.getCmp(nop);
    		if (p) {
    			op.hide();
    			p.show();
    			this.activeOptions = nop;
    		}
    		return true;
    	}
    });
    Ext.reg('advicles-window-filetypeedit', Advicles.window.EditFiletype);
    

    Однако, когда сохраняем форму в окошке, все зависает. Данные в файл отправляются, но в обработке ответа получается ошибка
    TypeError: g is undefined
    var g = this.getRoot(a), e = g.length, d = e, k = true;

    Файл - filetypelist.php - самописный, поэтому я могу в нем сделать любой вывод. Какой json должен возвращаться, чтобы ошибка не появлялась? Пробовала {"success":true} - не срабатывает.
    Помогите, пожалуйста.
      • 20380
      • 118 Posts
      Источник ошибки найден - root в данном случае - data