Reproduce editor visual effects after ajax update

Reproduce editor visual effects after ajax update

Brendan_McBrendan_Mc Posts: 2Questions: 1Answers: 0

I'm using editor to allow users to perform edits on multiple tables. At the moment the page has three datatables but ultimately will have another four. Editor works a treat for updating the tables individually but I also have a use case whereby the user will need to trigger a blanket update of all the tables - because the update needs to be performed as a single database transaction, I can't simply simply trigger a series of individual editor submits. Instead I'm using various parts of the editor and datatables APIs to compile a single JSON object and submit this to the server. It's working perfectly fine - when the data is returned from the server, I simply redraw all the affected tables. What I'm missing though is the nice visual effect that happens when I use editor to update a single table - the affected rows glow blue for a few moments, fading in and out nicely. Is there a way that this "glow" effect can be invoked through the API or could someone point me to the relevant part of the source code so that I can manually reproduce it.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,667Questions: 1Answers: 10,096 Site admin
    Answer ✓

    Can you use Editor's multi-row editing API to do what you need?

    If that doesn't suit, then this is the function Editor uses to do the glow - where node is the tr element to glow:

    var __dtHighlight = function ( node ) {
        // Highlight a row using CSS transitions. The timeouts need to match the
        // transition duration from the CSS
        node = $(node);
    
        setTimeout( function () {
            node.addClass( 'highlight' );
    
            setTimeout( function () {
                node
                    .addClass( 'noHighlight' )
                    .removeClass( 'highlight' );
    
                setTimeout( function () {
                    node.removeClass( 'noHighlight' );
                }, 550 );
            }, 500 );
        }, 20 );
    };
    

    Allan

  • Brendan_McBrendan_Mc Posts: 2Questions: 1Answers: 0

    Hi Allan. Thanks for the quick response. I've implemented the multi-row editing for individual datatables and this is what I'm trying to emulate when submitting the data from all datatables to the server in a single call. The code you've provided above is exactly what I needed. Thanks.

This discussion has been closed.