Click here to Skip to main content
15,905,028 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: drop down list and submit button Pin
Andre Oosthuizen6-Dec-23 7:05
mveAndre Oosthuizen6-Dec-23 7:05 
Questiondropdown Pin
prasad penkey4-Dec-23 1:39
prasad penkey4-Dec-23 1:39 
AnswerRe: dropdown Pin
Richard Deeming4-Dec-23 1:45
mveRichard Deeming4-Dec-23 1:45 
AnswerRe: dropdown Pin
Andre Oosthuizen11-Dec-23 7:27
mveAndre Oosthuizen11-Dec-23 7:27 
Questionjavascript alert() not showing Pin
Ashish Tiwari Aug20233-Dec-23 6:00
Ashish Tiwari Aug20233-Dec-23 6:00 
AnswerRe: javascript alert() not showing Pin
Dave Kreskowiak3-Dec-23 9:07
mveDave Kreskowiak3-Dec-23 9:07 
QuestionInserting HTML from a fetch gives me extra blank rows..? Pin
William Morris 202124-Oct-23 18:58
William Morris 202124-Oct-23 18:58 
AnswerRe: Inserting HTML from a fetch gives me extra blank rows..? Pin
enhzflep27-Oct-23 23:00
enhzflep27-Oct-23 23:00 
AnswerRe: Inserting HTML from a fetch gives me extra blank rows..? Pin
Richard Deeming29-Oct-23 23:16
mveRichard Deeming29-Oct-23 23:16 
GeneralRe: Inserting HTML from a fetch gives me extra blank rows..? Pin
Richard MacCutchan30-Oct-23 0:53
mveRichard MacCutchan30-Oct-23 0:53 
QuestionInserting HTML from a fetch gives me extra blank rows..? Pin
William Morris 202124-Oct-23 8:31
William Morris 202124-Oct-23 8:31 
QuestionMoving a <div> from right edge of screen to left slowly? Pin
Blake McKenna27-Sep-23 17:51
Blake McKenna27-Sep-23 17:51 
AnswerRe: Moving a <div> from right edge of screen to left slowly? Pin
Steve Raw21-Oct-23 17:39
professionalSteve Raw21-Oct-23 17:39 
QuestionJasmine - monitor all calls of a method? Pin
NoMoreStackOverflow22-Sep-23 0:25
NoMoreStackOverflow22-Sep-23 0:25 
AnswerRe: Jasmine - monitor all calls of a method? Pin
jschell23-Sep-23 14:25
jschell23-Sep-23 14:25 
GeneralRe: Jasmine - monitor all calls of a method? Pin
NoMoreStackOverflow23-Sep-23 20:33
NoMoreStackOverflow23-Sep-23 20:33 
AnswerRe: Jasmine - monitor all calls of a method? Pin
jschell25-Sep-23 8:10
jschell25-Sep-23 8:10 
GeneralRe: Jasmine - monitor all calls of a method? Pin
NoMoreStackOverflow25-Sep-23 15:29
NoMoreStackOverflow25-Sep-23 15:29 
QuestionMutation Observer, editing a value Pin
jkirkerx15-Aug-23 11:49
professionaljkirkerx15-Aug-23 11:49 
AnswerRe: Mutation Observer, editing a value Pin
jkirkerx15-Aug-23 12:07
professionaljkirkerx15-Aug-23 12:07 
Strange how when I post something here, it makes me rethink the problem in a different way.

I concluded that I need to create the observer first, populate that observer with code to update the totals posted at the bottom, and then run the code to change the invoice. Pretty much backwards in order, but I get it now. At least I think this is correct, and it works so far, but I haven't tested enough to confirm that it doesn't conflict with anything.

Makes sense now, setup the mutation observer, program the response when it fires, then run the code to update the invoice.
export function updateAnyTypeInvoiceInvoiceRecordMutationObservable(classCode, catalogId, invRecordId, jsonData, data) {

        const observer = new MutationObserver(mutationsList => {
            for (const mutation of mutationsList) {

                // Text content within one of the observed nodes has changed
                // You can respond to the change here
                console.log('Text content has changed:', mutation.target.textContent);

                Code that adds up all the invoice cost, and changes the total at the bottom

                // get a list of unprocessed mutations
                // should be called before disconnecting,
                // if you care about possibly unhandled recent mutations
                let mutationRecords = observer.takeRecords();
                console.log(mutationRecords);

                // After a reasonable time, disconnect the observer even if the element wasn't found
                observer.disconnect();

            }
        });

        // Specify the options for the observer
        const config = { childList: true, subtree: true, characterData: true };
        const targetNode = document.getElementById('invInvoiceAmount_' + classCode + '_' + invRecordId);<br />
        observer.observe(targetNode, config);

        Javascript that changes the invoice values called last

    } catch (error) {
        console.log('updateAnyTypeInvoiceInvoiceRecordMutationObservable Error', error);
        alert('updateAnyTypeInvoiceInvoiceRecordMutationObservable Error: ' + error);
    }
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com

GeneralRe: Mutation Observer, editing a value Pin
Richard Deeming15-Aug-23 21:36
mveRichard Deeming15-Aug-23 21:36 
GeneralRe: Mutation Observer, editing a value Pin
jkirkerx16-Aug-23 6:33
professionaljkirkerx16-Aug-23 6:33 
AnswerRe: C++ Issue: Forgotten Virtual Destructor - Need Help Resolving! Pin
Richard MacCutchan15-May-23 1:53
mveRichard MacCutchan15-May-23 1:53 
GeneralRe: C++ Issue: Forgotten Virtual Destructor - Need Help Resolving! Pin
Richard Deeming15-May-23 5:25
mveRichard Deeming15-May-23 5:25 
Question[Learning/Beginner] Confused about await, async and fetch. Pin
Maximilien2-May-23 3:09
Maximilien2-May-23 3:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.