Our blazing fast Grid component built with pure JavaScript


Post by lauragomez »

Bryntum documentation says to use finalizeCellEdit to check if the value introduced is correct or not. If the introduced value is incorrect, we should return false and the expected behaviour of the cell in this case could be configured using invalidAction.

However, this isn't working properly. If we configure invalidAction with 'revert' or 'block' the editor is not closed and the finalizeCellEdit event is never dispatched again so we can't fix the value of the cell to a new one. That the editor is not closed is great in our case as we also want to show a message error using setError but to be able to fix the cell value is still needed.

Here a video of the error happening with invalidAction as 'revert' on this bryntum demo.

Screen Recording 2023-05-24 at 17.07.26.mov
(28.86 MiB) Downloaded 37 times

On the video, first, we insert an incorrect value and we fixed it with another incorrect value. Then we insert an incorrect value and we fixed it with a correct value.

To be able to reproduce it, just change the Score column configuration for:

        {
          text : 'Score',
          field : 'score', 
          editor : 'number',
          finalizeCellEdit: ({value, inputField}) =>{ 
		console.log('finalizeCellEdit');
		inputField.setError('error message');
		return value > 30;
	  },
	  invalidAction: 'revert',
           width : '5em'
 },

Thank you in advance!


Post by marcio »

Hey lauragomez,

Thanks for the recording and detailed report. I created a ticket to fix that https://github.com/bryntum/support/issues/6845

Best regards,
Márcio


Post by lauragomez »

Hi Marcio!

3 weeks have already passed and the bug is not in progress yet. Is there any problem?

We need to deliver our product to our customers in a few weeks. If it is not being fixed soon, could you give us some workaround? And an estimated start date.

Thank you in advance


Post by alex.l »

Hi, thanks for your patience! We raised priority for that task and added "high-prio" label so things will go faster from now. I can't give you any dates, but it should be there in next or after next release. I would say 1-3 weeks, but that's very raw forecast.

All the best,
Alex


Post by lauragomez »

Nice, thank you for the help Alex!!


Post by nickolay »

@lauragomez Hi, sorry for delay and thank you for your patience. The rootcause of this issue is that there's a call to inputField.setError() which marks the input field as invalid - and that error is never cleared.

Instead, you should return a string from the finalizeCellEdit and that string will be used as an error message for the validation process (this was previously undocumented feature, we've updated the docs). Also this error will be cleared with the new user input.

Also, you should set the invalidAction to block, not revert, because revert stops the editing completely.

Hopefully this helps, please let me know if you'll have any further questions.


Post Reply