Not sorting correctly by the column title #687

This commit is contained in:
Karel Picman 2018-03-06 14:22:21 +01:00
parent e5bb2d30b6
commit fb923fcc61
11 changed files with 35 additions and 15 deletions

View File

@ -441,15 +441,18 @@ class DmsfFolder < ActiveRecord::Base
# 11 - (position)
pos += 1
return pos if column == 'position'
# 12 - (size)
# 12 - (size calculated)
pos += 1
return pos if column == 'size_calculated'
# 13 - (modified)
# 13 - (modified calculated)
pos += 1
return pos if column == 'modified_calculated'
# 14 - (version)
# 14 - (version calculated)
pos += 1
return pos if column == 'version_calculated'
# 15 - (clear title)
pos += 1
return pos if column == 'clear_title'
nil
end

View File

@ -129,3 +129,4 @@
<td class="none">0</td>
<td class="none"><%= subfolder.modified.to_i if subfolder %></td>
<td class="none">0</td>
<td class="none"><%= title %></td>

View File

@ -88,3 +88,4 @@
<td class="none">0</td>
<td class="none"><%= subfolder.modified.to_i if subfolder %></td>
<td class="none">0</td>
<td class="none"><%= title %></td>

View File

@ -140,3 +140,4 @@
<td class="none"><%= file.last_revision.size %></td>
<td class="none"><%= file.last_revision.updated_at.to_i %></td>
<td class="none"><%= file.last_revision.iversion %></td>
<td class="none"><%= title %></td>

View File

@ -82,3 +82,4 @@
<td class="none"><%= file.last_revision.size %></td>
<td class="none"><%= file.last_revision.updated_at.to_i %></td>
<td class="none"><%= file.last_revision.iversion %></td>
<td class="none"><%= title %></td>

View File

@ -60,9 +60,10 @@
<% end %>
<th class ="dmsf_th"><%# controls %></th>
<th class="none"><%# position %></th>
<th class="none"><%# size %></th>
<th class="none"><%# updated %></th>
<th class="none"><%# version %></th>
<th class="none"><%# size calculated %></th>
<th class="none"><%# modified calculated %></th>
<th class="none"><%# version calculated %></th>
<th class="none"><%# clear title %></th>
</tr>
</thead>
<tbody>

View File

@ -61,9 +61,10 @@
<% end %>
<th class="dmsf_th"><%# controls %></th>
<th class="none"><%# position %></th>
<th class="none"><%# size %></th>
<th class="none"><%# updated %></th>
<th class="none"><%# version %></th>
<th class="none"><%# size calculated %></th>
<th class="none"><%# modified calculated %></th>
<th class="none"><%# version calculated %></th>
<th class="none"><%# clear title %></th>
</tr>
</thead>
<tbody>

View File

@ -82,3 +82,4 @@
<td class="none"></td>
<td class="none">link.updated_at.to_i</td>
<td class="none"></td>
<td class="none"><%= title %></td>

View File

@ -68,5 +68,6 @@
</td>
<td class="none">1</td>
<td class="none"></td>
<td class="none">link.updated_at.to_i</td>
<td class="none"><%= link.updated_at.to_i %></td>
<td class="none"></td>
<td class="none"><%= title %></td>

View File

@ -138,6 +138,7 @@
<% version_calculated = DmsfFolder.get_column_position('version_calculated') %>
<% size = DmsfFolder.get_column_position('size') %>
<% modified = DmsfFolder.get_column_position('modified') %>
<% clear_title = DmsfFolder.get_column_position('clear_title') %>
<%= late_javascript_tag do %>
$("#browser").dataTable({
@ -157,8 +158,11 @@
columnDefs: [
{ responsivePriority: 1, targets: <%= title %> },
{ responsivePriority: 2, targets: <%= commands %> },
{ searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] },
{ searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>, <%= clear_title %>] },
{ sortable: false, targets: [0, <%= commands %>] }
<% if title %>
,{ iDataSort: <%= clear_title %>, targets: [ <%= title %> ] }
<% end %>
<% if size %>
,{ iDataSort: <%= size_calculated %>, targets: [ <%= size %> ] }
<% end %>

View File

@ -83,9 +83,10 @@
<% end %>
<th class ="dmsf_th"><%# controls %></th>
<th class="none"><%# position %></th>
<th class="none"><%# size %></th>
<th class="none"><%# updated %></th>
<th class="none"><%# version %></th>
<th class="none"><%# size calculated %></th>
<th class="none"><%# modified calculated %></th>
<th class="none"><%# version calculated %></th>
<th class="none"><%# clear title %></th>
</tr>
</thead>
<tbody>
@ -182,6 +183,7 @@
<% version_calculated = DmsfFolder.get_column_position('version_calculated') %>
<% size = DmsfFolder.get_column_position('size') %>
<% modified = DmsfFolder.get_column_position('modified') %>
<% clear_title = DmsfFolder.get_column_position('clear_title') %>
<%= late_javascript_tag do %>
$('#browser').dataTable({
@ -201,8 +203,11 @@
columnDefs: [
{ responsivePriority: 1, targets: <%= title %> },
{ responsivePriority: 2, targets: <%= commands %> },
{ searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] },
{ searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>, <%= clear_title %>] },
{ sortable: false, targets: [0, <%= commands %>] }
<% if title %>
,{ iDataSort: <%= clear_title %>, targets: [ <%= title %> ] }
<% end %>
<% if size %>
,{ iDataSort: <%= size_calculated %>, targets: [ <%= size %> ] }
<% end %>