Datatable with all Weekdays by month as columns

Datatable with all Weekdays by month as columns

mihalispmihalisp Posts: 127Questions: 22Answers: 0

Hi everybody,
I use php with jquery datatables , I would like to create a table with months as rows and all weekdays's name by month as columns. The values in cells will be the number of day(1,2,3.. from 01/01/2018, 02/01/2018, 03/01/2018, ...).

The background color of the cell(already exists as table field) declares the type of employees' leave. The table has fields employee_id,leave_date,leave_type,leave_type_color.
I want something like below:

Is this possible with Datatables?
Thank you.

Answers

  • colincolin Posts: 15,171Questions: 1Answers: 2,589
    edited October 2018

    Hi @mihalisp ,

    Yep, that's possible, it's just a table with rows and columns. There will be several ways to colour the cells. You could use columns.render to modify the appearance of each, see this example here. Also, the callbacks can do that, such as createdRow as shown in this example.

    Hope that helps,

    Cheers,

    Colin

  • mihalispmihalisp Posts: 127Questions: 22Answers: 0

    Thank you.My main problem is how to put recurrent weekdays (about 36) as columns.I am a little bit confused on how to achieve this.How can i put the months as rows?

    Is there any code available?

  • colincolin Posts: 15,171Questions: 1Answers: 2,589

    Hi @mihalisp ,

    No, there's no code to use as an example, so you'll be starting from scratch. If you're not comfortable with DataTables, as it will require a lot of customisation, it would make sense to look for other plugins that are more aligned with calenders. This SO thread here might give some pointers.

    Cheers,

    Colin

This discussion has been closed.