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

View file

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

View file

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