Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions quickdialog/QSortingSection.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (QSortingSection *)init {
}

- (BOOL)needsEditing {
return _sortingEnabled;
return _sortingEnabled || _canDeleteRows;
}

- (void)fetchValueIntoObject:(id)obj {
Expand All @@ -58,6 +58,6 @@ - (BOOL)removeElementForRow:(NSInteger)index {
}

- (BOOL)canRemoveElementForRow:(NSInteger)integer {
return YES;
return _canDeleteRows;
}
@end
5 changes: 3 additions & 2 deletions quickdialog/QuickDialogDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInte
}

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return [[_tableView.root getVisibleSectionForIndex:indexPath.section] isKindOfClass:[QSortingSection class]];
id section = [_tableView.root getVisibleSectionForIndex:indexPath.section];
return [section isKindOfClass:[QSortingSection class]] && [section sortingEnabled];
}


Expand Down Expand Up @@ -85,7 +86,7 @@ - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sou
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
QSection *section = [_tableView.root getVisibleSectionForIndex: indexPath.section];
if ([section isKindOfClass:[QSortingSection class]]){
return ([(QSortingSection *) section canRemoveElementForRow:indexPath.row]);
return ([(QSortingSection *) section canRemoveElementForRow:indexPath.row]) || ((QSortingSection*)section).sortingEnabled;
}
return tableView.editing;
}
Expand Down
1 change: 1 addition & 0 deletions sample/SampleDataBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ + (QRootElement *)createSortingRoot {
QSortingSection *sortingSection = [[QSortingSection alloc] init];
sortingSection.key = @"sortedSection";
sortingSection.canDeleteRows = YES;
sortingSection.sortingEnabled = YES;
[sortingSection addElement:[[QLabelElement alloc] initWithTitle:@"First" Value:@"1"]];
[sortingSection addElement:[[QLabelElement alloc] initWithTitle:@"Second" Value:@"2"]];
[sortingSection addElement:[[QLabelElement alloc] initWithTitle:@"Third" Value:@"3"]];
Expand Down