adding a Row-Total Column?

adding a Row-Total Column?

xerk1xerk1 Posts: 6Questions: 5Answers: 1

I need to make Column(Total) Sum 3 Column(No1, No2, No3)


| No1 | No2 | No3 | Total |

| 2 | 5 | 3 | 10 |
| 7 | 4 | 4 | 15 |
| 2 | 1 | 2 | 5 |

| 3 | 5 | 1 | 10 |

<script type="text/javascript" language="javascript" class="init">  
    var editor; // use a global for the submit and return data rendering in the examples
    
    $(document).ready(function() {

        editor = new $.fn.dataTable.Editor( {
            ajax: 
            {
                url: "examples/php/subjects.php?exam=<?php echo $examid ?>",
                type: "POST",
            },
            table: "#example",
            fields: [ {
                    label: "Name Subject:",
                    name: "subjects.Name"
                }, {

                    label: "Name Class:",
                    name: "subjects.C_ID",
                    type: "select",
                    placeholder: "Select a Class"

                }, {
                    label: "Number1:",
                    name: "subjects.Exam1"
                },
                {
                    label: "Number2:",
                    name: "subjects.Exam2"
                },
                {
                    label: "Number3:",
                    name: "subjects.Exam3"
                }
            ]
        } );

        var table = $('#example').DataTable( {
            responsive: true,
            dom: "Bfrtip",
            "pageLength": 100,
            ajax: 
            {
                url: "examples/php/subjects.php",
                type: "GET",
                data: { 
                    "exam": <?php echo $examid ?>               },
            },
            ajaxUrl: "examples/php/subjects.php",
            columns: [
                {
                    data: null,
                    defaultContent: '',
                    className: 'select-checkbox',
                    orderable: false
                },
                { data: "subjects.Name" },
                { data: "classes.Name" },
                { data: "subjects.Exam1" },
                { data: "subjects.Exam2" },
                { data: "subjects.Exam3" },
                
            ],
            autoFill: {
                columns: [1],
                editor:  editor
            },
            keys: {
                columns: [1],
                editor:  editor,
            },
            select: {
                style:    'os',
                selector: 'td:first-child',
                blurable: true
            },
            buttons: [
                { extend: "create", editor: editor },
                { extend: "edit",   editor: editor },
                { extend: "remove", editor: editor }
            ]
        } );
    } );
</script>
This discussion has been closed.