Skip to content

Commit

Permalink
InlineAdd: Right click on cancel button does not trigger the cancel e…
Browse files Browse the repository at this point in the history
…vent anymore, it is also triggered by left mouseup, not mousedown, closes #445
  • Loading branch information
Pavel Janda committed Jun 11, 2017
1 parent 1ac14b4 commit 105db47
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions assets/src/datagrid.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,14 @@ $(document).on('click', '[data-datagrid-toggle-inline-add]', (e) ->
row.find('input:not([readonly]),textarea:not([readonly])').first().focus()
)

$(document).on('mousedown', '[data-datagrid-cancel-inline-add]', (e) ->
e.stopPropagation()
e.preventDefault()
$(document).on('mouseup', '[data-datagrid-cancel-inline-add]', (e) ->
code = e.which || e.keyCode || 0

if code == 1
e.stopPropagation()
e.preventDefault()

$('.datagrid-row-inline-add').addClass('datagrid-row-inline-add-hidden')
$('.datagrid-row-inline-add').addClass('datagrid-row-inline-add-hidden')
)

$.nette.ext('datagrid-toggle-inline-add', {
Expand Down

0 comments on commit 105db47

Please sign in to comment.