DataGrid sorting delayed


I’m bringing up a HUD in the didChangeSortOrderForColumn: callback to indicate a CPU intensive sort, prior to refreshing the grid. My issue is that the HUD is delayed by 2 seconds on an iPad 4. The culprit appears to be the DataGrid, which is doing some sort of innate sort of the data, prior to my code’s sort routine. This results in a delay prior to even getting to the callback. Switching the code to willChangeSortOrderForColumn: makes no difference. I’d like to be able to turn off the DataGrid’s internal sort. Is that possible?

My code is below -

// Handles taps on the header cell and sorts the rows corresponding to that column.
-(void)shinobiDataGrid:(ShinobiDataGrid *)grid didChangeSortOrderForColumn:(SDataGridColumn *)column from:(SDataGridColumnSortOrder)oldSortOrder
    if (![SVProgressHUD isVisible])
        [SVProgressHUD showWithStatus:@"Processing"
    // Schedule a timer so that the HUD is shown - not doing so only displays
    // the HUD after the function has ended.
    NSDictionary *userInfo = @{@"SortColumn": column};
    [NSTimer scheduledTimerWithTimeInterval:0.1

// An optimisation which sorts the data without refreshing all the loaded
// objects again
- (void)sortReportWithoutReloading:(NSTimer *)timer
    SDataGridColumn *column = timer.userInfo[@"SortColumn"];
    // CPU intensive sort happens here = [self sortedData];
    [datasourceHelper reloadData];
    [super refreshReport];
    [SVProgressHUD dismiss];


Greetings Program!

I don’t know if this will help but I use NSThread to execute it on the main thread:

[NSThread performBlockOnMainThread:^{ [SVProgressHUD showWithStatus:@"Processing" maskType:SVProgressHUDMaskTypeGradient]; }]

[NSThread performBlockOnMainThread:^{ [SVProgressHUD dismiss]; }]