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: 63,494Questions: 1Answers: 10,470 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,240Questions: 1Answers: 2,599

    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.