const linkTextValidation = ((textblock, oldstr, newstr) => {
this.dia.model.commit((m) => {
var data = m.linkDataArray[0]; // get the first link data
}
);
return result;
});```
in the above one i'm getting error linkDataArray not exist.
Have you read GoJS Validation -- Northwoods Software ?
The predicate function must return true or false, depending on whether the string resulting from the editing is permitted by your app. It must not have any side-effects. TextBlock | GoJS API
m.linkDataArray[0]
validations working fine, here accessing linkdataArray, giving error, linkDataArray property doesn’t exist
I repeat: you must not modify any state in a validation predicate, so do not call Model.commit. And I don’t see how result
makes any sense, unless you elided some code.
Is the value of m
not an instance of GraphLinksModel?
i’m updating in updatetextfunction, but error is resolved in typescript by using
if(m instanceof go.GraphLinksModel ) {
m.linkDataArray
}
If you had stated that it was a compile-time error, not a run-time error, your question would have been a lot clearer and I could have given you the answer much quicker.
In fact, I think there was no indication that the code is TypeScript.