Can not read property .set of undefined ...

Can not read property .set of undefined ...

alphadadalphadad Posts: 12Questions: 6Answers: 0

I keep getting the error "Cannot read property .set of undefined" when I try to update a field from a button. Code is as follows ...

      {
        extend: 'selectedSingle',
        text: 'Change Last Name',
        action: function(e, dt, node, config) {
          editorMain
            .edit( table.row( { selected: true } ).index(), false )
            .set( 'LastName', 'Some Last Name' )
            .submit();
//           editorMain
//             .remove(table.row( { selected: true } ).index(), false)
//             .submit();
        }

If I toggle the comments on the ".remove" and ".set" code, the record is faithfully deleted but I can't seem to make the ".set" code work.

What am I missing?

Dave

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @alphadad ,

    That should work, see example here.

    Would you be able to link to your page, or update that example, please, so that it can demonstrate the problem,

    Cheers,

    Colin

  • alphadadalphadad Posts: 12Questions: 6Answers: 0

    I'm not able to give you access to the site but this is the error that comes up using Editor 1.8.0 ...

    dataTables.editor.min.js:52 Uncaught TypeError: Cannot read property 'set' of undefined
    at String.<anonymous> (dataTables.editor.min.js:52)
    at Function.each (datatables.min.js:14)
    at f.set (dataTables.editor.min.js:52)
    at t.action (table.leaUsers_test.js:112)
    at HTMLAnchorElement.<anonymous> (datatables.min.js:247)
    at HTMLAnchorElement.dispatch (datatables.min.js:16)
    at HTMLAnchorElement.r.handle (datatables.min.js:16)

    Does that give you any insight?

    Dave

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    My guess is that you don't have a field by the name LastName in the Editor configuration. Could there be a typo there? It is case sensitive.

    Allan

This discussion has been closed.