Uncaught TypeError: Cannot read property 'error' of undefined

Uncaught TypeError: Cannot read property 'error' of undefined

chrisrbloomchrisrbloom Posts: 8Questions: 3Answers: 0
edited June 2015 in Editor

I'm using the editor to edit some simple text values, then return via REST to my table.

The data gets updated correctly, but I get this unhandled error and I can't edit the page anymore.

// Set up the Editor for the detailing log table
            editor = new $.fn.dataTable.Editor( {
                ajax: {
                    edit:{
                        url: "https://mysitename.sharepoint.com/_api/lists/getbytitle('DETAILING_LOG')/items(_id_)",
                        type: 'POST',
                        contentType: 'application/json;odata=verbose',
                        data: function (d){
                            //Setting up the data to be pushed to the table
                            //first, add in the metadata including the type of the item.
                            var itemPayload = {'__metadata': {'type': 'SP.Data.DETAILING_x005f_LOGListItem'}};
                            // now push all of the values from the form to the payload (values reside in d.data)
                            for(var prop in d.data){
                                   itemPayload[prop] = d.data[prop];
                             };
                             console.log(JSON.stringify(itemPayload));
                            return JSON.stringify(itemPayload);
                        },
                        headers: {
                            "Accept": "application/json;odata=verbose",
                            "X-RequestDigest" : $("#__REQUESTDIGEST").val(),
                            "X-HTTP-Method": "MERGE",
                            "If-Match": "*"}
                        }   
                    },
                    create:{
                        type: 'PUT',
                        url: ''
                    },
                    remove:{
                        type: 'DELETE',
                        url: ''
                    },
                    error: function(error){
                            console.log(JSON.stringify(error));
                    
                    },
                table: "#DETAILING_LOG",
                idSrc: "Id",
                fields: [ 
                    
                    {
                        label: "Description / Issue:",
                        name: "Title"},
                    {
                        label: "Hours Spent:",
                        name: "Hours"}
                ]
            } );
            
            $('#DETAILING_LOG').on( 'click', 'tbody td', function (e) {
                if($(this).index()==2 || $(this).index()==3 ){
                    editor.inline( this );
                };
            } ); 
        
        
        
        
        calldata.done(function (data,textStatus, jqXHR){
            $('#DETAILING_LOG').dataTable({
                "destroy": true,
                "processing": true,
                "data": data.d.results,
                "paging": false,
                "searching": false,
                "ordering": true,
                "columns": [
                    { "data": "Created", 
                      "className": "dt-center",
                      "width": "75px",
                      "render": function( data, type, full, meta){
                          var ThisDate = new Date(data);
                          var ThisDateHTML = moment(ThisDate).format("MM/DD/YYYY");
                          var ThisTimeHTML = moment(ThisDate).format("hh:mm A");
                          var ReturnedHTML = "";
                                                      
                          ReturnedHTML += "<div style='font-size: 10px'>";
                          ReturnedHTML +=   "<div>";
                          ReturnedHTML +=       ThisDateHTML;
                          ReturnedHTML +=   "</div>";
                          ReturnedHTML +=   "<div>";
                          ReturnedHTML +=       ThisTimeHTML;
                          ReturnedHTML +=   "</div>";
                          ReturnedHTML += "</div>";

                          return ReturnedHTML;
                      }
                    },
                    { "data": "Author.Title",
                      "width": "80px",
                      "className": "dt-left"},
                    { "data": "Title",
                      "className": "dt-left"},
                    { "data": "Hours",
                      "className": "dt-center"}
                    
                ]
              });
        });

Debug Code: ajurey

This discussion has been closed.