Complex object from custom cell editor

Tags: #<Tag:0x00007efc65544d78>

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 can be null from start and will be an object after cell has changed (i used own custom cell editor)

Also the comparison of schema is too strict.
Your logic in sources unable to resolve my case (step 1) and in general has very strange clauses.

   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;
              }
            }

Hey @lon9man

can I ask you to put the into any JSFiddle/JSBin playground? It will be much easier to debug.

JSFiddle: http://jsfiddle.net/longman/as1jwd9u/9/
videocast: https://drive.google.com/file/d/1NGF8WwzGDcbvoRv-q7Daii4AlChryKhS/view

Thank you for recording the video and sending the demo. Currently, Handsontable does not support objects as a value for a cell. I will ask our developer to share some tips as I may be missing something.

Hey again @lon9man

our developer spotted one misleading method and changed it. Does this work as expected http://jsfiddle.net/u0oqgfL2/?

your developer makes strange thing. he creates setValue-method, which i didn’t use for simplicity. also he removed my getValue-method, which was needed. what he wanted to say with such modification?

my logic step-by-step:

  1. for example initially i have NULL value in cell
  2. this cell has custom renderer, which can render any value (including complex object {a: 1})
  3. this cell has custom editor, which in getValue-method returns complex object ({a: 1}) for futher rendering
  4. on save handsontable (HOT) validates this complex object using algorithm from my first message
  5. such HOT’s algorithm unable to validate (but it seems should be) and unable to save my complex object in cell -> so cell’s value is reverted back to old value

I have discussed the subject with him. And as I wrote before, keeping object in a cell is currently not supported. Sorry for the misunderstanding.

got it