Dynamic update sum total when searching with JS

Viewed 27

i have a table with data

the table has a search by values at the top "search"

how can I make the total of the sum by columns and so that when searching for any value, the sum of the total changes

enter image description here

    <table id="table" data-toggle="table" data-pagination="true" data-search="true" data-show-columns="true" data-show-pagination-switch="true" data-show-refresh="true" data-key-events="true" data-show-toggle="true" data-resizable="true" data-cookie="true" data-cookie-id-table="saveId" data-show-export="true" data-click-to-select="true" data-toolbar="#toolbar">
    <thead>
        <tr>    
            <th data-field="NumberTicket">Номер билет</th>
            <th data-field="tarif" data-editable="">Тариф</th>
            <th data-field="taksa" data-editable="">Такса</th>
            <th data-field="Dop" data-editable="">Сбор</th>
            <th data-field="shtraf" data-editable="">Штраф</th>
            <th data-field="suma" data-editable="">Сумма</th>
            <th data-field="Delete" data-editable=""></th>
        </tr>
    </thead>
    <tbody>
        <?php
            $period=$BuilderDB->GetPeriud(array($_SESSION['UserID']));
            $d1=$period['d1'];
            $d2=$period['d2'];
            @$Balance=$BuilderDB->GetTicket(array($_SESSION['ClientID'], $d1, $d2, $_SESSION['ContragentID'] )); 
        ?>
        <?php
            foreach($Balance as $Value){
                $tok=$Value['Token'];
                echo "<tr>";
                    echo "<td></td>";
                    echo "<td>".iconv("windows-1251", "utf-8", $Value['BSONUM'])."</td>";    
                    echo "<td>".iconv("windows-1251", "utf-8",$Value['FARE'])."</td>";
                    echo "<td>".number_format(($Value["Taxe"]), 2, '.', ' ')."</td>";
                    echo "<td>".number_format(($Value["DopSborSub"]), 2, '.', ' ')."</td>";
                    echo "<td>".number_format(($Value["Penalty"]), 2, '.', ' ')."</td>";    
                    echo "<td>".number_format(($Value["TotalSub"]), 2, '.', '')."</td>";
                    echo "<td> <img src='img/bin.png' width='16' height='16' id='".$tok."' onclick='del(this.id);'/> </td>";
                echo "</tr>";
                }
            ?>
    </tbody>
</table>
0 Answers
Related