Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用selectoptions查询数据库_Jquery_Ruby On Rails_Ruby_Ajax - Fatal编程技术网

Jquery 使用selectoptions查询数据库

Jquery 使用selectoptions查询数据库,jquery,ruby-on-rails,ruby,ajax,Jquery,Ruby On Rails,Ruby,Ajax,我想在展示页面上实现排序功能,但我不知道如何实现它。我正在患者展示页面上查询剂量。我想使用ajax/jQuery,因为用户只需更改页面的一个部分,我不想重新加载它 <%= widget('fas fa-tag', 'Dosage').actions do %> <%= select_tag(:option, options_for_select([["Default", 1],["Current", 2],["Fin

我想在展示页面上实现排序功能,但我不知道如何实现它。我正在患者展示页面上查询剂量。我想使用ajax/jQuery,因为用户只需更改页面的一个部分,我不想重新加载它

<%= widget('fas fa-tag', 'Dosage').actions do %>
      <%= select_tag(:option, options_for_select([["Default", 1],["Current", 2],["Finished", 3]], params[:option] ), id: "select") %>
    <% end.thead do %>
      <th>Drug</th>
      <th>Date</th>
      <th>Status</th>
    <% end.table(patient.dosages.with_items_any, responsive: false, limit: 10, total: patient.dosages.count, more_path: dosages_path(dosages_search_id: 'all', dosage_search: {query: {all_fields: "patient_id:#{patient.id}"}}, commit: "Search")
       ) do |dose| %>
      <tr>
        <td><%= typed_pretty_link_to dose %></td>
        <td><%= truncate(dose.subject, length: 55) %></td>
        <td><%= l dose.created_at.to_date %></td>
        <td><%= dose.status %></td>
        <td><%= link_to 'View', dosage_path(dose.id) %></td>
      </tr>
    <% end if allow?('dosages-index') %>

任何帮助或指导都将不胜感激。谢谢

为什么不使用datatable?我已经在从数据库中查询了,我只想按状态或降序对它们进行不同的排序。您使用的datatable库是什么?大多数数据表已经有了排序功能。Filterrific有一些非常好的rails视图排序选项。
Patient.find(params[:id])