Complex data

I need to be able to store complex data (custom object) in a cell. I already have a cell editor and a cell renderer and I also have created a custom type for it. However It still doesn’t work. When my editor returns a complex object and that the orgValue was null, it doesn’t take the new value.

Debugging through the code, I can see:

  1. my cell cannot be null and must be of an object whose schema is equals to my new value schema
  2. the function in question is duckSchema

I can also see that in settings you can create a schema by setting dataSchema. except that it doesn’t seem to be used when comparing the value returned by the editor and the oldValue especially if the original cell value is null.

Also the comparison of schema is too strict. One would expect that the new value has at least all the properties define in the schema not exactly the same number of properties. The code in question is (in the populateFromArray function)

       if (value !== null && typeof value === 'object') {
                if (orgValue === null || typeof orgValue !== 'object') {
                  pushData = false;
                } else {
                  var orgValueSchema = duckSchema(orgValue[0] || orgValue);
                  var valueSchema = duckSchema(value[0] || value);
                  if (isObjectEquals(orgValueSchema, valueSchema)) {
                    value = deepClone(value);
                  } else {
                    pushData = false;
                  }
                }

Should I open an issue?

Hi @pdemilly
I’d be very hard to give any tips without seeing your solutions as you created your own editors and renderers.

Is there a possibility to create a simple (isolated) demo where the issue is visible?

I assume that if there where to reply for more than 2 weeks we can close this issue.