JS - Определение функции отображения окна сенча - PullRequest
0 голосов
/ 04 января 2019

Я пытаюсь назначить этот процесс функции, чтобы я мог добавить слушателя к кнопке, но он продолжает давать мне «Uncaught SyntaxError: missing) после списка аргументов». Кто-нибудь может направить меня в правильном направлении?

function popWindow() {
Ext.create('Ext.window.Window', {
    bodyStyle: "background-color:#FFFFFF",
    title: 'QA Tools',
    height: 300,
    width:400,
    layout: 'absolute',
    items: [{
        xtype: 'button',
        x: 15,
        y: 35,
        height: 35,
        width: 125,
        text: 'Sell Listings',
        itemId: 'sellBtn',
    }, {
		xtype: 'button',
        x: 15,
        y: 90,
        height: 35,
        width: 125,
        text: 'Set SP Cycle to 1 Min',
        itemId: 'sp1MinBtn',
	}, {
		xtype: 'button',
        x: 15,
        y: 145,
        height: 35,
        width: 175,
        text: 'Set Single AP Cycle to 1 min',
        itemId: 'singleAPMinBtn',
	}, {
		xtype: 'button',
        x: 15,
        y: 200,
        height: 35,
        width: 175,
        text: 'Set Grouped AP Cycle to 1 min',
        itemId: 'groupedAPMinBtn',
	},  {
		xtype: 'textfield',
        x: 170,
        y: 36,
        height: 30,
        width: 175,
        allowBlank: false,
        minLength: 7,
        maxLength: 7,
        emptyText: 'Enter Listing ID',
        itemId: 'sellListingField',
	}]
}
}).show();

Может кто-нибудь помочь мне заставить это работать?

1 Ответ

0 голосов
/ 04 января 2019

Да, ваш JavaScript недействителен. Обычно такое предупреждение означает, что у вас есть некорректный код. Я рекомендую запустить его через префиксатор , такой как этот , чтобы помочь выстроить фигурные скобки и найти проблему. Когда мы делаем это с вашим кодом, мы видим 2 ошибки.

  1. Вы не закрываете функцию с завершающей фигурной скобкой
  2. У вас есть 1 слишком много скобок перед .show

Это должно выглядеть так

function popWindow() {
    Ext.create('Ext.window.Window', {
        bodyStyle: "background-color:#FFFFFF",
        title: 'QA Tools',
        height: 300,
        width: 400,
        layout: 'absolute',
        items: [{
            xtype: 'button',
            x: 15,
            y: 35,
            height: 35,
            width: 125,
            text: 'Sell Listings',
            itemId: 'sellBtn',
        }, {
            xtype: 'button',
            x: 15,
            y: 90,
            height: 35,
            width: 125,
            text: 'Set SP Cycle to 1 Min',
            itemId: 'sp1MinBtn',
        }, {
            xtype: 'button',
            x: 15,
            y: 145,
            height: 35,
            width: 175,
            text: 'Set Single AP Cycle to 1 min',
            itemId: 'singleAPMinBtn',
        }, {
            xtype: 'button',
            x: 15,
            y: 200,
            height: 35,
            width: 175,
            text: 'Set Grouped AP Cycle to 1 min',
            itemId: 'groupedAPMinBtn',
        }, {
            xtype: 'textfield',
            x: 170,
            y: 36,
            height: 30,
            width: 175,
            allowBlank: false,
            minLength: 7,
            maxLength: 7,
            emptyText: 'Enter Listing ID',
            itemId: 'sellListingField',
        }]
    }).show();
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...