Looking for Example to Render MySql Data into a any popular javescript grid

57 views
Skip to first unread message

Steven Siperas

unread,
Oct 5, 2016, 9:03:47 AM10/5/16
to Express
 

T


I have Express with Nodejs connected to a MySql db and I can populate a list on my ejs page but I am searching for an example where I can load a grid like slickgrid,datatable etc either passing rows or json


Thanks for any assistance


my route


var
data; /* GET home page. */ router.get('/', function(req, res, next) { connection.connect(); connection.query('SELECT * from crg_version', function(err, rows) { data = JSON.stringify(rows); if (err) throw err; console.log('Data received from Db:\n'); console.log(rows); res.render('drugdb', { title: 'Express', name: 'Sippy', items: rows}); }); connection.end(); }); module.exports = router;


my view with list



  <% include templates/header.ejs %>

  <ul>
    <% if(items.length){

      for(var i = 0;i < items.length;i++) { %>
        <li><%=items[i].desc%></li>

     <% }

   } %>
  </ul>

  
Reply all
Reply to author
Forward
0 new messages