jQWidgets Forums

jQuery UI Widgets Forums Grid Prevent paste in cellbeginedit of a jqxgrid

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

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

  • GThireau
    Participant

    Hi,

    Is it possible to prevent a paste event in “cellbeginedit” of a jqxgrid?
    I would allow copying and limit pasting.
    For this I set the clipboard attribute of the jqxgrid to true.

    I implement the cellbeginedit of all columns with this function to limit input:

     var cellbeginedit = function (row, datafield, columntype, value) {
                       // some code
                        if (condition) return false;
    }

    This works well except when we pasting data.

    So I also implement the cellbeginedit of my jqxgrid like that:

    $('#jqxgrid').on('cellbeginedit', function (event) {
                        var args = event.args;
                       // some code
                       // ...
                      if ( condition) {
                           // event.preventDefault() ;
                           // return false ;
                       }
    });

    I’m catching the past event, i can detect if my condition is true but I’m unable to “prevent” the paste event.

    I would like to bee able to prevent the cellbeginedit event and cancel the change of the cell value.

    Is it possible ?
    Could you help me on this?
    Thank you.


    Ivo Zhulev
    Participant

    Hi GThireau,

    Try catching the paste event in the grid, something like that:

    $(‘#jqxgrid’).on(‘paste’, function (event) {
    return false;
    });

    Best Regards,
    Ivo

    jQWidgets Team
    http://www.jqwidgets.com/


    GThireau
    Participant

    Hi Ivo Zhulev,

    Unfortunately it doesn’t work, actually this doesn’t catch any paste event.

    Furthermore, if they were, how can I know in which cells the past is triggered ?

    Because this is those ‘target’ cells which define if I have to prevent or not the paste.

    Regards.

    GThireau

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

You must be logged in to reply to this topic.