简体   繁体   中英

Ruby on Rails and html table features

can you help me with ruby on rails and some html table features? I need to display my models in HTML table (it is easy part and i've done it) and i want to add some features to my table:

1) Drag and drop items in the table

2) Add toolbar with some actions for checked items (for example edit checked entity button)

3) In grid editing

I have Controller now and HTML table in my view:

    <table class='table table-striped table-condensed table-bordered table-hover'>
  <caption>Tasks</caption>
  <thead>
  <tr>
    <th>Task Name</th>
    <th>Description</th>
    <th>Status</th>
    <th>Start Date</th>
    <th>End Date</th>
  </tr>
  </thead>
  <tbody>
  <% @tasks.each do |task| %>
      <tr>
        <td><%= task.name %></td>
        <td><%= task.description %></td>
        <td><%= task.status %></td>
        <td><%= task.start_date %></td>
        <td><%= task.end_date %></td>
      </tr>
  <% end %>
  </tbody>
</table>

Can u please provide me some examples how to do it? Should i use coffee script for this?

Thx

Yes you will have to use Javascript to write this. You don't have to use CoffeeScript, if you're a beginner, I would just start with some simple jQuery, and then move on to a framework (such as ReactJS or Angular).

You can use " sortable " from jQuery UI to sort your tasks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM