How to limit log entries and avoid duplicate records?

How to limit log entries and avoid duplicate records?

caecae Posts: 4Questions: 0Answers: 0
edited June 2017 in Free community support

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?

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Are you using DataTables' Editor? If not, how are you updating your database?

  • caecae Posts: 4Questions: 0Answers: 0

    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

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    You're not giving enough information.

    at the beginning it has no records

    What has no records? The database? So whenever somebody starts to work, the database is empty?

    when it is confirmed

    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.

  • caecae Posts: 4Questions: 0Answers: 0

    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.

  • caecae Posts: 4Questions: 0Answers: 0

    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;
    }
    });

This discussion has been closed.