Create modal with Ext.js

Hello everybody,

i’m trying to develop a window form to be opened as the handler of a custom button click.
I was able to:

  • Create the custom button (easy)
  • Open the window
  • Create the form
  • add simple standard Ext.js fields

Now I’m trying without success to add a Pimcore’s manyToOneRelation field.
I have a 404 error with the xtype: No route found for “GET /admin/widget/manyToOneRelation.js”

Here’s my code:

object.toolbar.add({
text: “Test”,
iconCls: ‘pimcore_icon_import’,
scale: ‘medium’,
handler: function (obj) {

	var prodotto = Ext.create('pimcore.object.classes.data.manyToOneRelation',{},{
		name: "prodotto",
		title: "Prodotto Cipi",
		classes: [{classes:"Product"}],
		fieldtype: "fieldtype",
		datatype: "data",
		type: "manyToOneRelation",
		relationType: true,
		objectsAllowed: true,
		assetsAllowed: false,
		documentsAllowed: false,
		mandatory: true,
		lazyLoading: false,
		xtype: 'manyToOneRelation'
	});
	
	var win = new Ext.Window({
		title: "test",
		layout: 'border',
		width: "50%",
		height: 460,
		closeAction: 'hide',
		buttonAlign: 'center',
		animShow: function () {
			this.el.slideIn('t', {duration: 1, callback: function () {
					this.afterShow(true);
				}, scope: this});
		},
		animHide: function () {
			this.el.disableShadow();
			this.el.slideOut('t', {duration: 1, callback: function () {
					this.el.hide();
					this.afterHide();
				}, scope: this});
		},
		items: [
			{
				xtype: 'form',
				bodyPadding: 5, 
				flex: 1,
				items: [
					Ext.create('Ext.Panel',{
						width: 500,
						height: 300,
						title: "Panel title",
						items: [
							prodotto.getData()
						]
					})
				]
			}
		],
	});

	win.show(Ext.getBody());

}.bind(this, object)

});

Thank you in advance,
Marco

Found the solution by myself.
The point is that I must use the “tags” version of the field.

pimcore.object.tags.manyToOneRelation