Set also runtime @headerWidth after @onColResizeMouseup(), to used current @headerWidth e. g. on change sort order.

This commit is contained in:
Martin Edenhofer 2015-11-02 14:01:59 +01:00
parent 230c948f75
commit 9f56d141cd

View file

@ -447,6 +447,7 @@ class App.ControllerTable extends App.Controller
onColResizeMouseup: => onColResizeMouseup: =>
$(document).off 'mousemove.resizeCol' $(document).off 'mousemove.resizeCol'
# switch to percentage # switch to percentage
resizeBaseWidth = @resizeTargetLeft.parents('table').width() resizeBaseWidth = @resizeTargetLeft.parents('table').width()
leftWidth = @resizeTargetLeft.outerWidth() leftWidth = @resizeTargetLeft.outerWidth()
@ -462,15 +463,20 @@ class App.ControllerTable extends App.Controller
] ]
@log 'debug', @table_id, 'leftColumnKey', leftColumnKey, leftWidth, 'rightColumnKey', rightColumnKey, rightWidth @log 'debug', @table_id, 'leftColumnKey', leftColumnKey, leftWidth, 'rightColumnKey', rightColumnKey, rightWidth
@preferencesStore('headerWidth', leftColumnKey, leftWidth)
# update store and runtime @headerWidth
@preferencesStore('headerWidth', leftColumnKey, leftWidth)
@headerWidth[leftColumnKey] = leftWidth
# update store and runtime @headerWidth
if rightColumnKey if rightColumnKey
@preferencesStore('headerWidth', rightColumnKey, rightWidth) @preferencesStore('headerWidth', rightColumnKey, rightWidth)
@headerWidth[rightColumnKey] = rightWidth
sortByColumn: (event) => sortByColumn: (event) =>
column = $(event.currentTarget).closest('[data-column-key]').attr('data-column-key') column = $(event.currentTarget).closest('[data-column-key]').attr('data-column-key')
# sort # sort, update runtime @orderBy and @orderDirection
if @orderBy isnt column if @orderBy isnt column
@orderBy = column @orderBy = column
@orderDirection = 'ASC' @orderDirection = 'ASC'
@ -481,6 +487,8 @@ class App.ControllerTable extends App.Controller
@orderDirection = 'ASC' @orderDirection = 'ASC'
@log 'debug', @table_id, 'sortByColumn', @orderBy, 'direction', @orderDirection @log 'debug', @table_id, 'sortByColumn', @orderBy, 'direction', @orderDirection
# update store
@preferencesStore('order', 'orderBy', @orderBy) @preferencesStore('order', 'orderBy', @orderBy)
@preferencesStore('order', 'orderDirection', @orderDirection) @preferencesStore('order', 'orderDirection', @orderDirection)
@render() @render()