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"/>
|
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||||
<tableColumns>
|
<tableColumns>
|
||||||
<tableColumn width="116" minWidth="40" maxWidth="1000" id="KZ0-pD-Gxd">
|
<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"/>
|
<font key="font" metaFont="smallSystem"/>
|
||||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||||
@ -741,7 +741,7 @@
|
|||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||||
<prototypeCellViews>
|
<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"/>
|
<rect key="frame" x="1" y="1" width="116" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import Cocoa
|
|||||||
extension ViewController: NSTableViewDataSource, NSTableViewDelegate {
|
extension ViewController: NSTableViewDataSource, NSTableViewDelegate {
|
||||||
|
|
||||||
fileprivate enum CellIdentifiers {
|
fileprivate enum CellIdentifiers {
|
||||||
static let OTRSTicketNumber = "OTRSTicketNumber"
|
static let OTRSTicketNumber = "OTRSTicketCreated"
|
||||||
static let OTRSTicketOwner = "OTRSTicketOwner"
|
static let OTRSTicketOwner = "OTRSTicketOwner"
|
||||||
static let OTRSTicketDetails = "OTRSTicketDetails"
|
static let OTRSTicketDetails = "OTRSTicketDetails"
|
||||||
}
|
}
|
||||||
@ -26,14 +26,15 @@ extension ViewController: NSTableViewDataSource, NSTableViewDelegate {
|
|||||||
var text: String = ""
|
var text: String = ""
|
||||||
var cellIdentifier: 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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if tableColumn == self.ticketTableView.tableColumns[0] {
|
if tableColumn == self.ticketTableView.tableColumns[0] {
|
||||||
cellIdentifier = CellIdentifiers.OTRSTicketNumber
|
cellIdentifier = CellIdentifiers.OTRSTicketNumber
|
||||||
image = nil
|
image = nil
|
||||||
text = item.ticketNumber
|
text = item.created.description
|
||||||
} else if tableColumn == self.ticketTableView.tableColumns[1] {
|
} else if tableColumn == self.ticketTableView.tableColumns[1] {
|
||||||
cellIdentifier = CellIdentifiers.OTRSTicketDetails
|
cellIdentifier = CellIdentifiers.OTRSTicketDetails
|
||||||
image = nil
|
image = nil
|
||||||
@ -54,13 +55,10 @@ extension ViewController: NSTableViewDataSource, NSTableViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func tableViewSelectionDidChange(_ notification: Notification) {
|
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 {
|
let _:Ticket = userInfo["ticket"] as? Ticket else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
OTRS.sharedInstance.ticketDictionary.sort {
|
||||||
func catchTicketsUpdated(notification:Notification) -> Void {
|
$0.created > $1.created
|
||||||
DispatchQueue.main.async{
|
}
|
||||||
print("\(OTRS.sharedInstance.ticketDictionary.count) tickets to be shown")
|
|
||||||
|
DispatchQueue.main.async {
|
||||||
self.ticketTableView.reloadData()
|
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