Suggestion for dhx.Values

I have a use case where there is a requirement to make available more data sent to a ‘form’ than components defined within the form. This extra fields are used by change events on the components within the form for validation.

In dhx.Value, it appears that the setValues function is trying to keep the calling data around to be used by the getValues function. But is not successful.

Currently, in the debug source around line 6840 there is this line:

this._values = dhx.copy(data);

Not sure why the dhx.copy function is called since it looks to be for prototyping the calling parameter. By changing this line to:

this._values = data;

Then the getValues routine will work better. The getValues routine around line 6850 still needs to be changed from:

var data = (this._values?dhx.copy(this._values):{});


var data = this._values?this._values:{};

to retrieve the original data correctly. The rest of the routine will then update the data variable with the elements in the form before returning to the calling routine.

I think this would be a very useful enhancement.


Problem confirmed.

Normally dhx.copy returns some kind of objects copy ( prototype based copying ), but it creates the constant link between new value and original one, which may lead to data missing. We will update this branch in future to prevent problems similar to one in your case.