jQuery UI Widgets Forums DataTable Datatable Validation with Custom Editors

This topic contains 3 replies, has 2 voices, and was last updated by  Hristo 4 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • SteveP495
    Participant

    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


    Hristo
    Participant

    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 Hristov

    jQWidgets team
    https://www.jqwidgets.com


    SteveP495
    Participant

    Thanks 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) ?


    Hristo
    Participant

    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, the cellClassName callback will be useful (and also the cellsRenderer callback).
    About the tooltip, you could enable the enabletooltips property or add a custom tooltip – for this scenario the cellhover callback will be useful.
    Please, clarify if this does not help you.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.