Делаю свой грид, всплывает ошибка js в
/bitrix/components/bitrix/main.ui.grid/templates/.default/script.js
в части
Код |
---|
if (action.ACTION === self.actions.CALLBACK) {
this.confirmDialog(action, BX.delegate(function () {
if (BX.type.isArray(action.DATA)) {
action.DATA.forEach(function (currentCallback) {
if (currentCallback.JS.indexOf('Grid.') !== -1) {
callback = currentCallback.JS.replace('Grid', 'self.parent');
callback = callback.replace('()', '');
!! callback += '.apply(self.parent, [container])';
try {
eval(callback); // jshint ignore:line
} catch (err) {
throw new Error(err);
}
} else if (BX.type.isNotEmptyString(currentCallback.JS)) {
try {
eval(currentCallback.JS);
} catch (err) {
throw new Error(err);
}
}
});
}
}, this));
} |
к callback добавляется '.apply(self.parent, [container])'
при вызове выдает ошибку TypeError: Cannot read properties of undefined (reading 'apply')
код для формирования controlPanel ниже.
Код |
---|
$controlPanel = array('GROUPS' => array(array('ITEMS' => array())));
$snippet = new Snippet();
$oncha nge = new Snippet\Onchange();
$onchange->addAction(
[
'ACTION' => Actions::CALLBACK,
'CONFIRM' => true,
'CONFIRM_APPLY_BUTTON' => 'Подтвердить',
'DATA' => array(array('JS' => "Grid.sendSelected('{$pl}')"))
]
);
$applyButton = $snippet->getApplyButton( ['ONCHANGE' => $onchange->toArray()]);
$actionList = array(array('NAME' => '-ВЫБЕРИТЕ ДЕЙСТВИЕ-', 'VALUE' => 'none'));
$actionList[] = array(
'NAME' => 'ОТГРУЗИТЬ',
'VALUE' => 'shipall',
'ONCHANGE' => array(
<------>array(
<------><------>'ACTION' => Actions::CREATE,
<------><------>'DATA' => array($applyButton)
<------><------>),
<------>)
);
$controlPanel['GROUPS'][0]['ITEMS'][] = array(
"TYPE" => \Bitrix\Main\Grid\Panel\Types::DROPDOWN,
"ID" => "action_button",
"NAME" => "action_button",
"ITEMS" => $actionList
);
$controlPanel['GROUPS'][0]['ITEMS'][] = $snippet->getEditButton();
$controlPanel['GROUPS'][0]['ITEMS'][] = $snippet->getForAllCheckbox(); |
ЧЯДНТ?