Question about DataTables Editor

Question about DataTables Editor

Dennis ChanDennis Chan Posts: 18Questions: 8Answers: 0
  1. When I receive the HttpRequest in ApiController, can I know, in the ApiController, whether the request is from create, edit or delete action?

  2. If I want to set the key columns read only, can I control the columns in the create view not read only but the columns in the edit view read only?

  3. There is a validator which can validate whether the column is unique in ApiController. If there are compound keys, can I use validator to check the uniqueness of the compound keys? If no, is there any solution to validate the uniqueness of compound keys?

Answers

  • allanallan Posts: 63,852Questions: 1Answers: 10,519 Site admin

    1) There should be! It actually appears to be a missing feature in the .NET package. The DtRequest object has a RequestTypes enum for exactly this, but it isn't being exposed via an easy to use public API (the PHP version has this, so its a missing feature in the .NET package). However, depending on what you want to do, the server-side events can often offer a better option.

    2) Use the initCreate and initEdit events along with enable() and disable() to toggle fields.

    3) Currently no - there isn't a built in validator that will validate uniqueness over multiple columns. For that you would need to use a custom validator. That sounds like it would be a useful addition as well - thanks for the suggestion.

    Allan

This discussion has been closed.