Fixed table col. width issue / use own width for each @table_id.

This commit is contained in:
Martin Edenhofer 2015-10-24 14:04:05 +02:00
parent 0ace20fb4b
commit d59dc41862
3 changed files with 18 additions and 16 deletions

View file

@ -66,7 +66,7 @@ class App.ControllerTable extends App.Controller
overview: ['host', 'user', 'adapter', 'active']
model: App.Channel
objects: data
groupBy: 'group'
groupBy: 'adapter'
checkbox: false
radio: false
class: 'some-css-class'
@ -129,7 +129,7 @@ class App.ControllerTable extends App.Controller
# remove group by attribute from header
overview = _.filter(
overview
(item) ->
(item) =>
return item if item isnt @groupBy
return
)
@ -137,7 +137,7 @@ class App.ControllerTable extends App.Controller
# get new order
groupObjects = _.groupBy(
@objects
(item) ->
(item) =>
return '' if !item[@groupBy]
return item[@groupBy].displayName() if item[@groupBy].displayName
item[@groupBy]
@ -211,6 +211,7 @@ class App.ControllerTable extends App.Controller
# get content
@log 'debug', 'table', 'header', headers, 'overview', 'objects', @objects
table = App.view('generic/table')(
table_id: @table_id
header: headers
objects: @objects
checkbox: @checkbox
@ -371,7 +372,7 @@ class App.ControllerTable extends App.Controller
{ key: rightColumnKey, width: rightWidth }
]
@log 'error', @table_id, 'leftColumnKey', leftColumnKey, leftWidth, 'rightColumnKey', rightColumnKey, rightWidth
@log 'debug', @table_id, 'leftColumnKey', leftColumnKey, leftWidth, 'rightColumnKey', rightColumnKey, rightWidth
@preferencesStore('headerWidth', leftColumnKey, leftWidth)
@preferencesStore('headerWidth', rightColumnKey, rightWidth)
@ -400,12 +401,13 @@ class App.ControllerTable extends App.Controller
if !data[type][key]
data[type][key] = {}
data[type][key] = value
@log 'debug', @table_id, 'preferencesStore', data
localStorage.setItem(@preferencesStoreKey(), JSON.stringify(data))
preferencesGet: =>
storeKey = @preferencesStoreKey()
data = localStorage.getItem(storeKey)
data = localStorage.getItem(@preferencesStoreKey())
return {} if !data
@log 'debug', @table_id, 'preferencesGet', data
JSON.parse(data)
preferencesStoreKey: =>

View file

@ -281,7 +281,7 @@ class Table extends App.Controller
value
new App.ControllerTable(
table_id: "ticket_overview_#{@overview_id}"
table_id: "ticket_overview_#{@overview.id}"
overview: @overview.view.s
el: @$('.table-overview')
model: App.Ticket

View file

@ -15,7 +15,7 @@
<% end %>
<% for item, i in @header: %>
<th<%= " class='#{ item.className }'" if item.className %><%= " style='#{ item.style }'" if item.style %> data-column-key="<%= item.name %>">
<div class="table-column-head js-sort">
<div <% if @table_id: %>class="table-column-head js-sort"<% end %>>
<div class="table-column-title">
<%- @T( item.display ) %>
</div>
@ -25,7 +25,7 @@
<% end %>
</div>
</div>
<% if i < @header.length - 1: %>
<% if @table_id && i < @header.length - 1: %>
<div class="table-col-resize js-col-resize"></div>
<% end %>
</th>