sorted
This commit is contained in:
parent
99c2d8cf27
commit
c23853ebe7
Binary file not shown.
@ -729,7 +729,7 @@
|
||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableColumns>
|
||||
<tableColumn width="116" minWidth="40" maxWidth="1000" id="KZ0-pD-Gxd">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Ticket Nummer">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Erstellt am">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -741,7 +741,7 @@
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="OTRSTicketNumber" id="2Z7-ua-4Vs">
|
||||
<tableCellView identifier="OTRSTicketCreated" id="2Z7-ua-4Vs">
|
||||
<rect key="frame" x="1" y="1" width="116" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
|
||||
@ -11,7 +11,7 @@ import Cocoa
|
||||
extension ViewController: NSTableViewDataSource, NSTableViewDelegate {
|
||||
|
||||
fileprivate enum CellIdentifiers {
|
||||
static let OTRSTicketNumber = "OTRSTicketNumber"
|
||||
static let OTRSTicketNumber = "OTRSTicketCreated"
|
||||
static let OTRSTicketOwner = "OTRSTicketOwner"
|
||||
static let OTRSTicketDetails = "OTRSTicketDetails"
|
||||
}
|
||||
@ -26,14 +26,15 @@ extension ViewController: NSTableViewDataSource, NSTableViewDelegate {
|
||||
var text: String = ""
|
||||
var cellIdentifier: String = ""
|
||||
|
||||
guard let item:Ticket = OTRS.sharedInstance.ticketDictionary[row] else {
|
||||
guard row < OTRS.sharedInstance.ticketDictionary.count,
|
||||
let item:Ticket = OTRS.sharedInstance.ticketDictionary[row] else {
|
||||
return nil
|
||||
}
|
||||
|
||||
if tableColumn == self.ticketTableView.tableColumns[0] {
|
||||
cellIdentifier = CellIdentifiers.OTRSTicketNumber
|
||||
image = nil
|
||||
text = item.ticketNumber
|
||||
text = item.created.description
|
||||
} else if tableColumn == self.ticketTableView.tableColumns[1] {
|
||||
cellIdentifier = CellIdentifiers.OTRSTicketDetails
|
||||
image = nil
|
||||
@ -54,13 +55,10 @@ extension ViewController: NSTableViewDataSource, NSTableViewDelegate {
|
||||
}
|
||||
|
||||
func tableViewSelectionDidChange(_ notification: Notification) {
|
||||
updateViewAfterSelectionDidChange()
|
||||
}
|
||||
let row = ticketTableView.selectedRow
|
||||
let myTableViewFromNotification = notification.object as! NSTableView
|
||||
|
||||
private func updateViewAfterSelectionDidChange() {
|
||||
let selectedRow = ticketTableView.selectedRow
|
||||
|
||||
print(selectedRow)
|
||||
print(myTableViewFromNotification)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -78,13 +78,18 @@ class ViewController: NSViewController {
|
||||
let _:Ticket = userInfo["ticket"] as? Ticket else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func catchTicketsUpdated(notification:Notification) -> Void {
|
||||
DispatchQueue.main.async{
|
||||
print("\(OTRS.sharedInstance.ticketDictionary.count) tickets to be shown")
|
||||
OTRS.sharedInstance.ticketDictionary.sort {
|
||||
$0.created > $1.created
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.ticketTableView.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
func catchTicketsUpdated(notification:Notification) -> Void {
|
||||
print("\(OTRS.sharedInstance.ticketDictionary.count) tickets to be shown")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user