jQuery UI Widgets Forums Grid Reset Grid events

This topic contains 2 replies, has 2 voices, and was last updated by  Pietro 8 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Reset Grid events #74640

    Pietro
    Participant

    Hello,
    I have an application with forms and in each form there is a grid bind to remote data grids.
    Enetering in a form, the grid is initialized with datasource and events linke ‘bindingcomplete’ ‘rowdoubleclick’.
    Everything works fine except if I quit that form and enter again.
    On entering infact, the grid is reinitialized again for a second time:
    – the data source is refreshed (perfect)
    – the event are initialized for a second time: the bindingcomplete event does reinitialize all the columns, while the rowdoubleclick appears to be ADD to the event list for a second time.
    In fact doublecicking on a rows execute the function associated with it two times…
    How can I avoid that ?
    Is there a method to clear/destroy the events definition to avoid they are creatd two times ?
    Thanks in advance

    Reset Grid events #74659

    Dimitar
    Participant

    Hello Pietro,

    You need to unsubscribe from the events before subscribing to them again, e.g.:

    $('#jqxGrid').off('rowdoubleclick');
    
    $('#jqxGrid').on('rowdoubleclick', function(event) {
        // event handler code
    });

    However, we do not recommend initializing the grid and subscribing to its events multiple times. If you need to update the grid, you only have to set its source property again or call its updatebounddata method. Initializing a grid multiple times may lead to unexpected behaviour.

    Best Regards,
    Dimitar

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

    Reset Grid events #74853

    Pietro
    Participant

    Thanks Dimitar,
    this solved my problem.
    Pietro

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

You must be logged in to reply to this topic.