How to limit log entries and avoid duplicate records?
How to limit log entries and avoid duplicate records?
cae
Posts: 4Questions: 0Answers: 0
Regards!
I'm just trying DateTables and I find it great! I have not tried for more than a day but I have some quick queries that I could not find:
How can I ensure that the user adds 5 records to the table and is not allowed to add more?
Is it possible to avoid duplicate records from DateTables?
This discussion has been closed.
Replies
Are you using DataTables' Editor? If not, how are you updating your database?
Yes, I use DataTables editor and I relied on this example: https://editor.datatables.net/examples/bubble-editing/simple.html
The difference is that at the beginning it has no records, the user must add them manually and when it is confirmed they will be uploaded to a database
You're not giving enough information.
What has no records? The database? So whenever somebody starts to work, the database is empty?
What do you mean by "confirmed"? Some kind of validation within the Editor? Some external means of approval?
It's not up to others to guess or attempt telepathy. You have to explain your situation in sufficient detail.
I am sorry.
It is an empty table, no records of any database is just an empty table nothing more, it does not interact at any time with databases any of that. The user must click on the 'New' button and create a record in the table, what I want is that when I have 5 records (5 columns) I can not click on the 'New' button or an error message that says "You can not enter more records," is all I want.
Also if DataTables has some property or functionality to verify if the record to enter is duplicated or not.
After searching for a long time I managed to come up with a somewhat practical solution:
editor.on('preOpen', function (e, o, action) {
if (action == 'create' && $('#table').dataTable().fnGetData().length >= 5) {
alert('Solution');
return false;
}
});