Can .set access a function

Can .set access a function

obrienjobrienj Posts: 93Questions: 38Answers: 0
edited September 13 in Editor

I have the following code:

            $('#cc-list').on('click', 'a.editor_copy', function (e) {

                // get the current row
                copyrow = $(this).closest('tr');

                // in case all row data not loaded, get index of selected row
                var ix = copyrow["0"]._DT_RowIndex;

                // get all the data for the selected row
                rowdata = table.row(ix).data();

                // copy actually does a 'create' but with fields populated from the current (copied) row
                        title: 'Create event',
                        buttons: [
                           //{ label: 'Cancel', fn: function () { this.close(); } }
                        title: rowdata['title'],
                        allDay: '0',
                        action: '0',

                        locHolder: function() {copyLoc(rowdata);},


This is the code that supports a "copy" function that I include on every row in the datatables list window, that is,

Edit / Copy / Delete

I have verified the the function "copyLoc" returns the correct value but it doesn't appear in the field when the editor window appears.

Note that "title:", "allDay:, and "action:" all refer to valid columns in the database, but "locHolder:' only exists on the editor window and is constructed by "copyLoc".

Is this valid coding?



  • allanallan Posts: 42,159Questions: 1Answers: 5,357 Site admin

    Try this:

                title: rowdata['title'],
                allDay: '0',
                action: '0',
                locHolder: copyLoc(rowdata),

    As it was you were assigning a function to the locHolder parameter. You could execute that function immediately, but just calling copyLoc directly would do the same thing.


Sign In or Register to comment.