0

What is the best method to rewrite the adminhtml grid (with serializer) to modify the rowClickCallback function?

I want to replace the rowClick function in my custom module form:

rowClick: function (grid, event) {
    var trElement = Event.findElement(event, 'tr'),
        isInput   = Event.element(event).tagName == 'INPUT', //eslint-disable-line eqeqeq
        checkbox, checked;

    if (trElement) {
        checkbox = Element.select(trElement, 'input');

        if (checkbox[0] && !checkbox[0].disabled) {
            checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
            this.grid.setCheckboxChecked(checkbox[0], checked);
        }
    }
    this.getOldCallback('row_click')(grid, event);
}

with the following:

rowClick: function (grid, event) {
    var trElement = Event.findElement(event, 'tr'),
        isInput   = Event.element(event).tagName == 'INPUT', //eslint-disable-line eqeqeq
        isSelect   = Event.element(event).tagName == 'SELECT'
        checkbox, checked;


    if (trElement && !isSelect) {
        checkbox = Element.select(trElement, 'input');

        if (checkbox[0] && !checkbox[0].disabled) {
            checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
            this.grid.setCheckboxChecked(checkbox[0], checked);
        }
    }
    this.getOldCallback('row_click')(grid, event);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.