Avoid exceeding certain number of duplicates

Avoid exceeding certain number of duplicates

Manuel PerezManuel Perez Posts: 1Questions: 1Answers: 0

Hi,

I'm new at code developing and I want to know if you can help me.

Is there a way to achieve avoiding to create a new register using datatables when the value has repeated a certain number of times (lets say 3 times). This is because I want to allow to use a referal ID no more than this number of times.

Answers

  • allanallan Posts: 48,114Questions: 1Answers: 6,922 Site admin

    Assuming that you are using Editor, you would need to create a custom validator. The provided database validator only checks for duplicates. In your case you'd need to select the count of the matching number of rows.

    Regards,
    Allan

  • colincolin Posts: 2,424Questions: 0Answers: 432

    Hi @Manuel Perez ,

    You can use the API call row().delete() to delete rows once the table has been initialised, or you could use jQuery and remove it from the DOM.

    Hope that helps,

    Cheers,

    Colin

Sign In or Register to comment.