osx - SWIFT OS X - Pre-selecting row in tableView not working -
i using code below in viewdidload() try , pre-select table row in tableview object (tblprojectnumber). no errors @ compile or run time.
everything loads ok , can select table rows mouse click without problems once view loaded. however, cannot load view required default row pre-selected. have tried following code in viewdidload() (the last 3 lines refer). tableview not show selected row , not scroll row @ index(100) when data loads.
override func viewdidload() { super.viewdidload() self.view.wantslayer = true self.view.layer?.backgroundcolor = nscolor.windowbackgroundcolor().cgcolor self.view.window?.title = "project detail module" self.view.window?.titlevisibility // sort list of project numbers display correctly when view first loaded self.sortprojectnumberarray() self.loadprojectrowdataarray() self.sortpprfilesforlatestdate() // pre-select table row load on initial display of tableview let index = nsindexset(index: 100) self.tblprojectnumber.scrollrowtovisible(100) self.tblprojectnumber.selectrowindexes(index, byextendingselection: true) }
answers here: select row in tableview programmatically other method beside calling indexpath
and here: select tableview row programmatically
and here: xcode - swift programatically select tablecell
have helped haven't been able solve issue. call selectrowatindexpath used in last link doesn't seem available in swift doesn't work me either.
any assistance appreciated.
try code inside tableview(tableview: nstableview, viewfortablecolumn tablecolumn: nstablecolumn?, row: int) -> nsview?
method.
don't know select method work in osx
selectrowatindexpath
correct method ios
. try every possible selectindex method of osx
inside viewfortablecolumn
method through tabledata actully being displayed. i.e. while displaying tabledata..it check index want selected.
hope may !
Comments
Post a Comment