我的应用程序是用一个节点开发的,这个节点在一个页面上应该加载3800条或更多的记录并显示在一个表上。我已经设法创建了一些过滤器,当我应用它们时,页面需要一段时间才能响应。我创建的过滤器只是客户端,它们所做的唯一事情就是隐藏过滤器之外的表元素。
这是我的服务器端代码:
app.get('/query', (req,res) =>{
sql='SELECT u.sendingdate, cl.alias, u.customerkey, cl.idCliente, u.media, cl.nomeCliente, i.Nazione, u.itemkey, u.publicationname, u.publicationkey FROM uploads AS u LEFT JOIN customer AS cl ON cl.idCliente = u.idCliente LEFT JOIN rubric AS r ON r.idRubric = u.customerkey LEFT JOIN tab_iso AS i ON u.countryisocode = i.ISO WHERE u.sendingdate >= "' + start + '" AND u.sendingdate <= "' + end + '" GROUP BY c.id;'
con.query(sql, (err, uploads, fields) =>{
if (err) throw err;
con.query('SELECT i.Nations FROM uploads AS u LEFT JOIN tab_iso AS i ON u.countryisocode = i.ISO GROUP BY Nations;', (err, nations, fields) =>{
if (err) throw err;
res.render('query.ejs', {uploads: uploads, nations: nations})
//SELECT ... FROM ... WHERE somecol >= '2011-01-01' AND somecol <= '2011-01-30'
})
})
})
这是一个页面,我使用ejs:
<table id="table" cellspacing="0" class="ui sortable celled table display" style="width:100%">
<thead>
<tr>
<th class="">Item Key</th>
<th class="">Date</th>
<th class="">Nation</th>
<th class="">Alias</th>
<th class="">Customer Name</th>
<th class="">Media</th>
<th class="">GMDID</th>
<th class="">Headline</th>
</tr>
</thead>
<tbody id="tbody">
<% for(var i = 0; i < uploads.length; i++) { %>
<tr class="record">
<td><%= uploads[i]["itemkey"] %></td>
<td><%= uploads[i]["sendingdate"] %></td>
<td class="nationC"><%= uploads[i]['Nazione'] %></td>
<td><%= uploads[i]["alias"] %></td>
<td><%= uploads[i]["nomeCliente"] %></td>
<td><%= uploads[i]["media"] %></td>
<td><%= uploads[i]["publicationkey"] %></td>
<td><%= uploads[i]["publicationname"] %></td>
</tr>
<% } %>
<p id="counter"><%= i %></p>
</tbody>...
暂无答案!
目前还没有任何答案,快来回答吧!