jQuery UI Widgets › Forums › DataTable › Datatable Validation with Custom Editors
Tagged: custom, datatable, slider, validation
This topic contains 3 replies, has 2 voices, and was last updated by Hristo 3 years, 1 month ago.
-
Author
-
Hi,
I have a custom editor for a datatable column (a jqxSlider) and am following the validation code on this page:
Validation example using a slider as in my case
My validation is per the below:
function (cell, value) {if (value > 25 || value < 5) return { message: ‘Number should be in the 5-25 interval’, result: false };return true;}
So this does work (as if I enter a value below 5 or greater than 25, the row stays in edit mode) BUT the custom editor (slider in this case) is ALWAYS present and so the red style to the underlying datatable cell is never visible and the tooltip with the error information is never visible.
What options do I have (destroying the editor isn’t one as I already tried that !).
Thanks for any help 🙂
Steve
Hello Steve,
The structure of your example produces such behavior.
You cannot end cell editing mode while there is an invalid value.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.comThanks Hristo for the support,
Yes I understand that it’s just that, in my example, there is now no VISUAL way for a user to know that validation has failed (as the validation error formatting is never seen by the user). Does that make sense ? If so, what would you suggest ? Is there a way to detect the failed validation on the datatable cell and then format the custom editor in some way (eg red style with some tooltip) ?
- This reply was modified 3 years, 1 month ago by SteveP495.
Hello Steve,
If I understand you right, you want to show the user that there are cells that are not valid.
You could change its style to looks different – for this purpose, thecellClassName
callback will be useful (and also thecellsRenderer
callback).
About the tooltip, you could enable theenabletooltips
property or add a custom tooltip – for this scenario thecellhover
callback will be useful.
Please, clarify if this does not help you.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.