Using Datatables for data entry application?

Using Datatables for data entry application?

BasementjackBasementjack Posts: 19Questions: 7Answers: 0

Hi,

I've got a MSAccess database I'm migrating to the web.

One feature of access is when a user is entering new records into the table, new lines automatically appear when they hit "enter" on the last column.

This has made MSAccess wonderful for users who are entering repetitive data by hand, as they don't need to use the mouse at all during data entry.

Is there a mode to DataTables that would display a table of data, with a blank row at the bottom that users could start adding data to, to replicate what they had in MSAccess?

Lastly are there hooks that I can tap into to provide certain functionality?
For example, in the MSAccess Database, in a date field, I have it set so the user can hit Plus or Minus (+/-) to increment or decrement the date by 1, and I auto populate a few fields based on the record prior.

Finally, while I'm referring to DataTables, Its fine to suggest DataTables Editor, which I assume would be a pre-req for the data entry work.

  • Jack

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Actually, creation of a new row inline with the table is not a feature of Editor at this time. It will likely come in future updates, but at the moment the create action needs to be done in the main form editor.

    The ordering of the rows in the DataTable is entirely dependent upon the data in them and the ordering applied to the table. So the row.add() method which is used to add a row normally probably wouldn't be too much use to you here.

    You would need to simply do an appendChild (or similar jQuery method) to the tbody with your empty row with inputs. The problem with that is that DataTables will remove that row on the next draw unless you do actually use row.add() once the data has been entered by the user.

    Allan

  • BasementjackBasementjack Posts: 19Questions: 7Answers: 0

    Thanks Allan!

  • BasementjackBasementjack Posts: 19Questions: 7Answers: 0

    Allan, one more question - how does row.add() and append child work in conjunction with the 'millions of rows' scenario? Is there a way that Datatables can only render what's on screen, and if so then does the append child take the on screen table from say 40 rows to 41?

    I want to avoid shoving 1 million rows to the browser every time just to append one and start adding data if possible.

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Exactly as you say. If you append a new row using jQuery or DOM methods, then it will be shown in the table, but not part of the DataTable (if that makes sense). So yes, it would say "Showing 1 to 10" records, but might actually have 11 (including the new one).

    Perhaps one approach might be to have the input elements always shown in the table footer with a "add row" button at the end of the row. Then the user can just type in whenever they want.

    Allan

This discussion has been closed.