Editor with field not existing in a table

Editor with field not existing in a table

ralfeusralfeus Posts: 24Questions: 6Answers: 1

Hi all,
I want to edit color information and for this purpose found a field type plugin as discussed in https://datatables.net/forums/discussion/32658/color-picker

In order to be able to quickly enter same colors I've added to the form one field, which doesn't exist in source table and whose purpose is to update primary color field. I haven't finished with all details yet but I've encountered the situation that I can't submit this form. The example is here: http://live.datatables.net/cotakaxe/2
Now it can not be submitted but if you comment out {name: 'appearance.color.text'} (that's the one which doesn't exist in the table) form can be submitted.

How can I add to the edit form additional input that won't go to the submit anyway?

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    I updated your test case so it runs by adding buttons.js and css.
    http://live.datatables.net/yojeguto/1/edit

    The test case is getting this error:

    Uncaught TypeError: Cannot create property 'text' on string ''

    Take a look at this Stack Overflow Thread.

    I'm not sure why its happening within the Datatables/Editor code but the 'appearance.color and 'appearance.color.text aren't created before being assinged causing the error. Something like this seems to work:

                {
                    label: "Color",
                    name: 'appearance.color'
                },
                {name: 'appearance.text'}
    

    Here is the example:
    http://live.datatables.net/davegotu/1/edit

    @allan or @colin will be able to explain why it happens and how to handle the appearance.color.text object.

    Kevin

  • ralfeusralfeus Posts: 24Questions: 6Answers: 1

    I've figured out three and more parts field name causes issue

This discussion has been closed.