Challenging idea, looking for a solution

Challenging idea, looking for a solution

nessinitsnessinits Posts: 86Questions: 27Answers: 0

Hi all,

I'm using datatables now for about half a year. This forum has helped me further in many occassions. Hopefully also in this case. I have a challenging idea (perhaps not for you, but certainly for me). I'm building a datatable page to let employees write their time, so it should become a timesheet.

The idea is use a datatable as a timesheet, but I want it to work so one can inline edit the information in the timesheet. Consisting out of 7 rows for each day of the week. The challenge is that I cannot guarantee that all rows are in the database. I've tried to solve this with a (javascript) dataset, but then I need a DTRowId to interact with the database.

Another approach is to create the rows when asking for the timesheet through ajax, but this ends in a lot of database rows that aren't used.

Does anyone know what's the best way to solve this? Did anyone had a similar challenge and how did you solve it?

Kind regards,
nessinits

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    Answer ✓

    Two options that I can immediately think of:

    1. Add the records to the database when the page is loaded - i.e. before rendering it to the client, check to see if the records exist in the database. If not, then create them and load them as normal.
    2. Create a client-side only table which could be augmented with data from the server (if any or all of the rows exist). Then when the user is done they'd hit a submit / save button and the rows could be saved or created on the database as required.

    There are probably other options, but those are the two that spring to mind.

    Interesting challenge - let us know how you get on.

    Allan

This discussion has been closed.