-
Notifications
You must be signed in to change notification settings - Fork 0
Adding Columns
In order to properly add a column, you must first instantiate an instance of StackBaseColumn using one of its specialized constructors and then add that instance to the table using the table's addColumns: method.
Declaration
+(instancetype)textColumnWithName:(NSString *)nameExample
[StackBaseColumn textColumnWithName:@"Name"];Declaration
+(instancetype)numericColumnWithName:(NSString *)name shouldBeUnsigned:(BOOL)isUnsigned;Example
[StackBaseColumn numericColumnWithName:@"Number" shouldBeUnsigned:NO];Declaration
+(instancetype)dateTimeColumnWithName:(NSString *)name type:(StackBaseDateTimeType *)type;Example
[StackBaseColumn dateTimeColumnWithName:@"Date" type:StackBaseDateTimeTypeDATE];Note on Date-Time Columns
Date-Time columns are unique in that they accept a StackBaseDateTimeType parameter. This parameter affects the formatting of data the column accepts. There are five different types, and they affect data formatting as follows:
StackBaseDateTimeTypeDATE accepts data in the format: 'YYYY-MM-DD'
StackBaseDateTimeTypeTIME accepts data in the format: 'HH:MM:SS'
StackBaseDateTimeTypeYEAR accepts data in the format: 'YYYY'
StackBaseDateTimeTypeDATETIME accepts data in the format: 'YYYY-MM-DD HH:MM:SS'
StackBaseDateTimeTypeTIMESTAMP does not accept data. Will automatically assign a value based on the exact time data is posted in the format: 'YYYY-MM-DD HH:MM:SS'
It is important to understand that a date-time column will try to parse a formatted value out of whatever input it receives, even if that input does not follow the format it was assigned. However, a date-time column will always return data in the format it was assigned.
Declaration
-(void)addColumns:(NSArray<StackBaseColumn *> *)columns completionBlock:(StackBaseEditCompletion) compBlock;Example
[weakSelf.table addColumns:@[[StackBaseColumn textColumnWithName:@"Name"]] completionBlock:^(BOOL success, NSString *responseMessage) {
if(success){
NSLog(@"Operation Successful.");
}else{
NSLog(@"Operation Unsuccessful.");
}
}];Note
Columns can also be included when creating a new table. See 'Adding Tables.'
Intro
Managing Tables
Managing Columns
Managing Rows
Conditions
Going Forward