Dynamic Columns
Dynamic Columns
tdk
Posts: 32Questions: 16Answers: 0
I wonder if this is possible, I've looked around the forums but can't find a suitable answer.
I have this data returned from SQL where the date columns represent days in a date range (much like a timesheet)
Id | Description | 05/12/2016 | 08/12/2016 | 09/12/2016 | 10/12/2016 | 11/12/2016 |
6 | AAA | 2 | | 2 | | |
7 | BBB | 2 | | | | |
8 | CCC | 1 | 3 | | | |
9 | DDD | | | | | |
10 | EEE | | 4 | | | |
11 | FFF | | | 2 | | |
12 | AAA | | | | | |
I use Dapper and the resulting result set looks something like this
[0]: {{DapperRow, Id = '6', EmployeeId = '1', ActivityId = '1', ProjectId = '1', ClientId = '1', Description = 'AAA', 2016-12-05 = '2.00', 2016-12-08 = NULL, 2016-12-09 = NULL, 2016-12-10 = NULL, 2016-12-11 = NULL}}
[1]: {{DapperRow, Id = '7', EmployeeId = '1', ActivityId = '2', ProjectId = '1', ClientId = '1', Description = 'BBB', 2016-12-05 = '2.00', 2016-12-08 = NULL, 2016-12-09 = NULL, 2016-12-10 = NULL, 2016-12-11 = NULL}}
[2]: {{DapperRow, Id = '8', EmployeeId = '1', ActivityId = '3', ProjectId = '1', ClientId = '1', Description = 'CCC', 2016-12-05 = '1.00', 2016-12-08 = NULL, 2016-12-09 = NULL, 2016-12-10 = NULL, 2016-12-11 = NULL}}
[3]: {{DapperRow, Id = '9', EmployeeId = '1', ActivityId = '4', ProjectId = '1', ClientId = '1', Description = 'DDD', 2016-12-05 = NULL, 2016-12-08 = '0.50', 2016-12-09 = NULL, 2016-12-10 = NULL, 2016-12-11 = NULL}}
[4]: {{DapperRow, Id = '10', EmployeeId = '1', ActivityId = '5', ProjectId = '1', ClientId = '1', Description = 'EEE', 2016-12-05 = NULL, 2016-12-08 = NULL, 2016-12-09 = '3.00', 2016-12-10 = NULL, 2016-12-11 = NULL}}
[5]: {{DapperRow, Id = '11', EmployeeId = '1', ActivityId = '1', ProjectId = '1', ClientId = '1', Description = 'FFF', 2016-12-05 = NULL, 2016-12-08 = NULL, 2016-12-09 = NULL, 2016-12-10 = '1.00', 2016-12-11 = NULL}}
[6]: {{DapperRow, Id = '12', EmployeeId = '2', ActivityId = '2', ProjectId = '1', ClientId = '1', Description = 'AAA', 2016-12-05 = NULL, 2016-12-08 = NULL, 2016-12-09 = NULL, 2016-12-10 = NULL, 2016-12-11 = '2.00'}}
How can I transform this into something datatables can use and ideally be editable?
This discussion has been closed.