OpusCapita / react-crudeditor

OpusCapita React CRUD Editor

Home Page:https://opuscapita.github.io/react-crudeditor/branches/master/?currentComponentName=ContractEditor&maxContainerWidth=100%25&showSidebar=false

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhance model.validate with viewName

dzhitomirsky-sc opened this issue · comments

Intro
Now model.validate takes the only parameter 'instance':

model: {
...
 validate: instance => {

 }
}

In certain cases it is needed to know from which validation is called (e.g. validating PK unique key).

ToDo
So, please extend validation function with the next api:

model: {
 validate: ({instance, viewName}) => {

 }
}

Relevant Mocha tests still need correction. They are describe.skip-ed now.

This was merged into #230 with fixed tests.

Change the function arguments to

model: {
  validate: ({persistentInstance, formInstance, viewName}) => {
    ...
  }
}