views:

7

answers:

0

Hi all,

I made a sample application displaying list of employees with their salaries over NSTableView using NSArrayController.

Basic functionality is working as intended. Also sorting is working fine when Selector - compare or caseInsensitiveCompare is assigned in attribute pane for table column- employeeName.

Problem occurs when I try to sort it by string length by setting selector in IB as - length, for the table column - employeeName. It does sorting by string length but does it inappropriately.

It is doing sorting on alternate clicks ie. on first click it sorts the content in table in descending order by length. Then on second click it does not arrange contents in ascending order by length but sets arrow on top as in ascending. Then on third click it arranges contents in ascending order by length but sets arrow on top of table column as in descending and so on...

Can anyone suggest if I am wrong somewhere?

Thanks,

Miraaj