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: 61,438Questions: 1Answers: 10,052 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: 15,112Questions: 1Answers: 2,583

    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

This discussion has been closed.