jquery - Hide table on no matches (wenzhixin's extended bootstrap table) -
i have page 3 tables. put "button formatter" on first table, when clicked sets data-url second two.
example:
window.actionevents = { 'click .edit': function (e, value, row, index) { $('#tabletwo').bootstraptable('refresh', { url: '/api/controllerexample/' + row.id + '/exampleactionone' }); $('#tablethree').bootstraptable('refresh', { url: '/api/controllerexample/' + row.id + '/exampleactiontwo' }); } };
now, not row "id" rows have data. , such kind of eye-sore 2 tables displaying have nothing display.
the question:
is possible set actionlistener table such "done loading data", , check if table empty, if perform logic (such setting div hidden)
solved own question.
bootstrap table supports events, listen on "load-success" event, when fires data table , check if no more 2 ( "[]" ). if 2 means table empty.
example:
$('#tabletwo').on('load-success.bs.table', function () { if (json.stringify($('#tabletwo').bootstraptable('getdata')).length < 3) { $('#containingdiv').hide(); } else { $('#containingdiv').show(); } });
Comments
Post a Comment