I process all the data on the page once (on one url http: // localhost: 9111 / sale / ').
And showing on different tabs on this page.
<div class="tab-base"> <ul class="nav nav-tabs"> <li class="active"> <a data-toggle="tab" href="#demo-lft-tab-1">Daily Sale</a> </li> <li> <a data-toggle="tab" href="#demo-lft-tab-2">Channel Wise Sale</a> </li> <li> <a data-toggle="tab" href="#demo-lft-tab-3">Returns</a> </li> </ul> </div> <div class="tab-content"> <form method="POST" action="{% url 'sale' %}"> {% csrf_token %} <div id="demo-lft-tab-1" class="tab-pane fade active in"> <div class="panel-body"> <table data-toggle="table"> <thead > <tr> <th data-align="center" data-sortable="true">Day</th> <th data-align="center" data-sortable="true">Sale Value</th> <th data-align="center" data-sortable="true">Quantity Sold</th> </tr> </thead> <tbody> {% for day, val, qty in sale_data %} <tr> <td>{{day}}</td> <td>{{val}}</td> <td>{{qty}}</td> </tr> {% endfor %} </tbody> </table> </div> </div> <div id="demo-lft-tab-2" class="tab-pane fade"> <div class="panel-body"> <table data-toggle="table" > <thead> <tr> <th data-align="center" data-sortable="true">Channel</th> <th data-align="center" data-sortable="true">Brand</th> <th data-align="center" data-sortable="true">Category</th> <th data-align="center" data-sortable="true">Selling Price</th> <th data-align="center" data-sortable="true">Quantity Sold</th> <th data-align="center" data-sortable="true">Percentage %</th> </tr> </thead> <tbody> {% for channel,brand,category,selling_price,quantity_sold, percentage in sal_data %} <tr> <td>{{channel}}</td> <td>{{brand}}</td> <td>{{category}}</td> <td>{{selling_price}}</td> <td>{{quantity_sold}}</td> <td>{{percentage}}%</td> </tr> {% endfor %} </tbody> </table> </div> </div> </form> </div>
But when the render data is large, loading the page takes longer.
Now I want to know how to load data only for the active tab?
source share