jquery - Bootstrap not being applied to a dynamically loaded table in datatables -


so i'm trying run allow run query on db , i'd display result on page. since query can return number of columns i'm calculating number of columns after query has returned , creating table. issue i've tried using bootstrap styling provided in datatables docs although page buttons correctly styled table isn't.

the html comes page styled correctly , classes generated seem correspond ones in bootstrap docs still style isn't applied.

you can check out page on www.dito.ninja complete code.

extends layout  block head     link(rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css")     link(rel="stylesheet" type="text/css" href="//cdn.datatables.net/plug-ins/1.10.7/integration/bootstrap/3/datatables.bootstrap.css")      script(type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.10.2.min.js")     script(type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.7/js/jquery.datatables.min.js")     script(type="text/javascript" language="javascript" src="//cdn.datatables.net/plug-ins/1.10.7/integration/bootstrap/3/datatables.bootstrap.js")     script(type="text/javascript" charset="utf-8")  block content   .row     .col-lg-6       div.label.label-default table name 'products'. write queries "select * products limit 100;"   .row     .col-lg-6       .input-group(role = "group")         input.form-control#my-input(type='text' value ='select * products limit 100;' style="width: 500px;")         span.input-group-btn           button.btn.btn-default#my-button(type='button' onclick='buttonclicked()') work! work!   .row     table#my-table    script.         function buttonclicked(){             $.post( '/users/query/', {qq: $('#my-input').val()} , function( data ) {                 var cols = [];                 (var col in data[0]) cols.push({"title": col});                 (var = 0; < data.length; ++i) {                     var newrow = [];                     (var val in data[i]) {                         newrow.push(data[i][val]);                     }                     data[i] = newrow;                 }                 $('#my-table').datatable({                     "data": data,                     "columns": cols                 });                });         } 

call function timeout

settimeout(function(){   buttonclicked() },1000); 

possibly calling before loading dom/script


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -