SelectListView : confirmed method seems never called


#1

Hi
i try this : sample of https://atom.io/docs/api/v0.60.0/api/classes/SelectListView.html

{SelectListView} = require 'atom'
class MySelectListView extends SelectListView
  initialize: ->
    super
    @addClass('overlay from-top')
    @setItems(['Hello', 'World'])
    atom.workspaceView.append(this)
    @focusFilterEditor()

  viewForItem: (item) ->
    "<li>#{item}</li>"

  confirmed: (item) ->
    console.log("#{item} was selected")

i’ve got the list, but i can’t get selected item as confirmed never called.


#2

Thanks for pointing this out! It looks like it is a bug in Atom Core. If you want a quick fix until we get the new release out try this:

{$, SelectListView} = require 'atom'
class MySelectListView extends SelectListView
  initialize: ->
    super
    @addClass('overlay from-top')
    @setItems(['Hello', 'World'])
    atom.workspaceView.append(this)
    @focusFilterEditor()

  viewForItem: (item) ->
    $("<li>#{item}</li>")

  confirmed: (item) ->
    console.log("#{item} was selected")

#3

@ProbablyCorey thanks a lot :smile: it works fine