我希望能够一次显示我的 SQL 数据库中的五个值,然后单击按钮能够显示接下来的五个值,直到我显示所有类(class)。现在这就是我试图显示它们的方式:
<%= form_for(Stc.new, action:'stcs#create') do |form| %>
<%= collection_check_boxes(:course_id, Course.all, :id, :title,{}) do
|form| %>
form.label { form.check_box }
<% end %>
<%= form.collection_select(:course_id, Course.all,:id, :title, {}, {
:multiple => false}) %>
<%= form.select(:semester, options_for_select([['Fall', 'Fall'],
['Spring', 'Spring'],['Summer', 'Summer']]), :id => 'sel1') %>
<%= form.select(:year, options_for_select([['2012', '2012'], ['2013',
'2013'], ['2014', '2014'], ['2015', '2015'], ['2016', '2016'], ['2017',
'2017']]), :id => 'sel2') %>
<%= form.select(:user_id, options_for_select([[1,@user.id]])) %>
<div class="actions">
<form id="my_sample_form">
</form>
<input type="submit" value="Submit" form="my_sample_form">
<% end %>
</div>
最佳答案
我想你想在这里做分页,你可以为此使用 gem, 一个 gem 是 'will_paginate' gem。
关于javascript - 以增量方式显示 SQLite 数据库中的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47687415/