Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initialise() on first slide upload #340

Merged
merged 1 commit into from
Apr 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions apps/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ <h5 class="modal-title" id="deleteModalLabel">Delete confirmation</h5>
if (data.length == 0) {
var div = document.querySelector('.container');
div.textContent = `No Data Found ... x _ x`;
div.classList = `text-center p-4`;
div.classList = `container text-center p-4`;
return;
}

Expand All @@ -410,11 +410,38 @@ <h5 class="modal-title" id="deleteModalLabel">Delete confirmation</h5>
tbody = data.map((d) => {
return "<tr>" + d.map((a) => "<td>" + a + "</td>").reduce((a, b) => a + b) + "</tr>";
});
totaltablepages = Math.ceil(data.length/$("#entries").val());
let entriesPerPage;
if($('#entries').val()===undefined)
entriesPerPage=10; // default value, when initially no slide
else
entriesPerPage= $('#entries').val();
totaltablepages = Math.ceil(data.length/entriesPerPage);
selectedpage = 0;
$("#search-table").val("");
searching = false;

if( data.length>0 && $('.container').children().length===0)
{
$('.container').html(`<div>
<div>
<h3 class="text-center h3 mb-0">Available Slides</h3>
<div class="search-box float-left form-group form-inline">
<select id='entries' class="select form-control mr-2">
<option value="10" selected>10 slides/page</option>
<option value="20">20 slides/page</option>
<option value="40">40 slides/page</option>
<option value="50">50 slides/page</option>
<option value="100">100 slides/page</option>
</select>
<input id="search-table" type="text" class="form-control" placeholder="Search&hellip;">
</div>
</div>
<div class="table-responsive">
<table id='datatables' class="table table-striped"></table>
</div>
</div >
`);
}
document.getElementById("datatables").innerHTML = `
<thead>${thead.reduce((a, b) => a + b)}</thead>
<tbody>${tbody.reduce((a, b) => a + b)}</tbody>
Expand Down