if (!Ext.ClassManager.isCreated("listComboModel")) {
	Ext.define("listComboModel", {
		extend: "Ext.data.Model",
		fields: [
			{ name: "id", type: "string" },
			{ name: "name", type: "string" }
		],
		proxy: {
			type: "ajax",
			url: "/ip2-services/" + "wshMailChimp.aspx?action=list",
			reader: {
				type: "json",
				rootProperty: "response.data",
				totalProperty: "total"
			}
		}
	});
}

Ext.define("Ext.ux.mailChimp.ListCombo", {
	extend: "Ext.form.field.ComboBox",
	alias: ["widget.mailchimplistcombo"],
	fieldLabel: ip2.i18n({ da: "Liste", en: "List" }),
	displayField: "name",
	valueField: "id",
	queryMode: "remote",
	typeAhead: false,
	selectOnTab: true,
	emptyText: ip2.i18n({ da: "Vælg en liste...", en: "Select a list..." }),
	triggers: {
		clear: {
			cls: "x-form-clear-trigger",
			weight: 1,
			handler: "onTrigger1Click",
			scope: "this"
		},
		picker: {
			weight: 2,
			handler: "onTriggerClick",
			scope: "this"
		}
	},
	listConfig: {
		width: 600
	},
	initComponent: function() {
		var me = this;

		me.store = Ext.create("Ext.data.Store", {
			model: "listComboModel"
		});

		me.callParent();
	},
	onTrigger1Click: function() {
		this.clearValue();

		this.up("panel").setSearchDisable();
	}
});
