Question about DataTables Editor
Question about DataTables Editor
When I receive the HttpRequest in ApiController, can I know, in the ApiController, whether the request is from create, edit or delete action?
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?
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
1) There should be! It actually appears to be a missing feature in the .NET package. The
DtRequest
object has aRequestTypes
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
andinitEdit
events along withenable()
anddisable()
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