osx - NSArrayController select inserted indices after insertion not reflected in NSTableView -
i have 2 nstableviews
both bound own nsarraycontrollers
, user can drag & drop items table table b. want dropped items in table b selected after insertion (so table can scroll them). it's not working.
- the table view selection indexes bound array controller indexes in ib.
select inserted objects
checked on array controllers in ib.- if check arraycontrollerb.selectedobjects lists first inserted object, if more inserted.
- selection never reflected in associated table view.
now, try temporarily store newly inserted objects in array , select them in arraycontrollerb via setselectedobjects()
, ...
func insertindicestotargetac(indexset:nsindexset) { let = indexset.toarray(); var tmpobjects = [anyobject](); in { let sourceitem = sourceac.arrangedobjects.objectatindex(i); let obj:nsmanagedobject = createnewfromsourceitem(sourceitem); targetac.addobject(obj); tmpobjects.append(obj); } sourceac.removeobjectsatarrangedobjectindexes(indexset); targetac.setselectedobjects(tmpobjects); println("\(targetac.selectedobjects)"); }
}
here, setselectedobjects()
show me correct amount of newly inserted objects in target ac still doesn't reflect selection in associated table view. can inaugurate me holy sanctuary of trivial cocoa operations persistently refuse work?
i figured out. shall not attempt tableview.reloaddata() after insertion. erase selection.
Comments
Post a Comment