Our blazing fast Grid component built with pure JavaScript


Post by edonovan »

Is there a way to turn off all tooltips other than the cell hover ones? Right now I am trying just to turn off the validation tooltips which appear on the date column editor .e.g. the ones which show 'Maximum/Minimum date violation' or 'Invalid Date Input' and I'm looking for a solution which will extend to other cell editors .e.g. text, combo dropdown select.


Post by saki »

Errors are shown by https://bryntum.com/products/grid/docs/api/Core/widget/Field#property-errorTip and there is no documented way to disable that.

However, you can alleviate the situation by setting validateOnIput : false.


Post by edonovan »

Thank you for your response. Where exactly do I add this? I tried adding it to the column definition but I still get the error when editing the date using the keyboard. For example, in the Cell edit demo here - https://bryntum.com/products/grid/examples/celledit/
I have modified the 'start' column config to be the following:

{
            text             : 'Start',
            id               : 'start',
            type             : 'date',
            field            : 'start',
            width            : '9em',
            finalizeCellEdit : 'up.validateStartDateEdit',
            max: new Date(),
            validateOnInput: false,
        },

And when I enter the cell edit, and change the year to 2025 using keyboard then the 'Maximum value violation' error tooltip is still showing.

Am I adding this config to the incorrect place?

Thanks.


Post by marcio »

Hey edonovan,

You need to set it like this

{
	text             : 'Start',
	id               : 'start',
	type             : 'date',
	field            : 'start',
	width            : '9em',
	finalizeCellEdit : 'up.validateStartDateEdit',
	editor: {
		validateOnInput : false
	}
}

Docs: https://bryntum.com/products/grid/docs/api/Grid/column/Column#config-editor

You can test that on the same demo that you mentioned here.

Best regards,
Márcio


Post by edonovan »

Hi marcio,

I have tried this too but when I add the 'min: new Date()' and change the date using keyboard to a future date then it still fires the 'Maximum value violation' error tooltip .e.g. if I change the year from 2019 to 2030 in the first Start cell.

This is now the full Start column configuration I have tried:

{
            text             : 'Start',
            id               : 'start',
            type             : 'date',
            field            : 'start',
            width            : '9em',
            finalizeCellEdit : 'up.validateStartDateEdit'
            editor: { validateOnInput : false},
            max: new Date(),
        },

Post by ghulam.ghous »

Hi there,

For that, you will have to override the isValid getter defined on the DateField class. Here's the code you want to override:

    get isValid() {
        const me = this;

    me.clearError('L{Field.minimumValueViolation}', true);
    me.clearError('L{Field.maximumValueViolation}', true);

    let value = me.value;

    if (value) {
        let { min, max, validateDateOnly } = me;

        // Validation of the date should only care about the date part
        if (validateDateOnly) {
            value = DH.clearTime(value, false);
            if (min) {
                min = DH.clearTime(min, false);
            }
            if (max) {
                max = DH.clearTime(max, false);
            }
        }

        if (min && value < min) {
            me.setError('L{Field.minimumValueViolation}', true);
            return false;
        }

        if (max && value > max) {
            me.setError('L{Field.maximumValueViolation}', true);
            return false;
        }
    }

    return super.isValid;
}

You just need to remove the me.setError('L{Field.maximumValueViolation}', true); and me.setError('L{Field.minimumValueViolation}', true); and you will be good to go.

Here's docs about on how to override https://bryntum.com/products/schedulerpro/docs/api/Core/mixin/Override.


Post by Animal »

I question the UX of applying validation to a field, but hiding any indication of why it is invalid from the user.

But you can just kill the input field's ability to display errors:

Screenshot 2024-03-26 at 07.23.32.png
Screenshot 2024-03-26 at 07.23.32.png (97.47 KiB) Viewed 193 times

Post Reply