मैं सभी डेटा को एक बार पृष्ठ में प्रस्तुत कर रहा हूं (एकल यूआरएल 'http://localhost:9111/sale/' पर)।टैब लोड होने पर ही लोड डेटा?
और उस पृष्ठ पर विभिन्न टैब में दिखा रहा है।
<div class="tab-base">
<!--Nav Tabs-->
<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>
<!-- here is more code for other tab same as above -->
<!-- -->
</form>
</div>
लेकिन जब डेटा प्रस्तुत करना बड़ा होता है तो पेज लोड में अधिक समय लगता है।
अब मुझे पता है, केवल सक्रिय टैब के लिए डेटा कैसे लोड करें?
आप टैब लिंक पर एक क्लिक श्रोता रखकर सक्रिय टैब लोड करने के लिए AJAX कॉल का उपयोग कर सकते हैं। –
@ बास्वानस्टिन मैं सामने के लिए नया हूं, क्या आप मुझे कोई लिंक या ट्यूटोरियल सुझा सकते हैं जहां मुझे वही मिलता है जो मैं चाहता हूं। –
मुझे लगता है कि यह शुरू करने के लिए एक अच्छा है: http://www.codexworld.com/load-more-data-using-jquery-ajax-php-from-database/ –