Inline Editor is not working

Inline Editor is not working

nivedita_keluskarnivedita_keluskar Posts: 4Questions: 1Answers: 0
edited June 2020 in Free community support
editor = new $.fn.dataTable.Editor( {
                ajax: "{{ route('update.call.wrap.up.inline', $patient[0]->id )}}",
                table: "#callwrap-list",
            //  idSrc:  0,
                fields: [
                    {
                        label: "CareManager Notes:",
                        name: "notes"
                    }, 
                    {
                        label: "Action Taken:",
                        name: "action_taken"
                    }, 
                ],
                

            });


$('#callwrap-list').on( 'click', 'tbody td:not(:first-child)', function (e) {
                 editor.inline( this, {
                    onBlur: 'submit'
                } );
            } );
            
             renderCallWrapUpTable();
var renderCallWrapUpTable =  function() {
                $('#callwrap-list').DataTable( {
                dom: "BlRfrti",
                ajax: "{{ route('monthly.monitoring.call.wrap.up', $patient[0]->id ) }}",
                columns: [
                            //{data: 'DT_RowIndex', name: 'DT_RowIndex'},
                            {data: 'topic', name: 'topic'},
                            {data: 'notes', name: 'notes'},
                            {data: 'action_taken', name: 'action_taken', orderable: false, searchable: false}
                        ],
                order: [ 1, 'asc' ],
                select: {                   
                    selector: 'td:first-child'
                },
                
            } );
        }

////////// initial data format
{"draw":0,"recordsTotal":36,"recordsFiltered":36,"data":[{"DT_RowId":"370","topic":"Because violence and abuse happens to a lot of people and affects their health we are asking the following questions. How often does anyone, including family and friends, physically hurt you?","notes":"Sometimes","action_taken":"test action point 2","status":"1","created_at":"2020-05-19 07:27:00","id":"370"},{"DT_RowId":"358","topic":"testing","notes":"test","action_taken":"test again changed to point 1","status":"1","created_at":"2020-05-15 13:26:49","id":"358"},{"DT_RowId":"273","topic":"Is there anything going on in your life that is particularly stressful","notes":"No, I don\u2019t believe so.","action_taken":"test again 3","status":"1","created_at":"2020-05-11 19:26:25","id":"273"},{"DT_RowId":"359","topic":"topic test","notes":"topic test","action_taken":"test point 4","status":"1","created_at":"2020-05-18 12:49:08","id":"359"},{"DT_RowId":"360","topic":"Who is in your family \/ who is your support system?","notes":"Friends","action_taken":null,"status":"1","created_at":"2020-05-19 05:30:57","id":"360"},{"DT_RowId":"361","topic":"Who lives with you?","notes":"test","action_taken":null,"status":"1","created_at":"2020-05-19 05:30:57","id":"361"},{"DT_RowId":"362","topic":"What type of living situation are you in?","notes":"1","action_taken":null,"status":"1","created_at":"2020-05-19 05:30:57","id":"362"},{"DT_RowId":"363","topic":"In the past 12 months, has lack of reliable transportation kept you from medical appointments, meetings, work or from getting things needed for daily living?","notes":"no","action_taken":"test","status":"1","created_at":"2020-05-19 05:30:57","id":"363"},{"DT_RowId":"281","topic":"Are you in any pain?","notes":"No","action_taken":"testing","status":"1","created_at":"2020-05-11 19:26:25","id":"281"},{"DT_RowId":"283","topic":"Other issues?","notes":null,"action_taken":"other issues","status":"1","created_at":"2020-05-11 19:26:25","id":"283"},{"DT_RowId":"364","topic":"Topic to discuss","notes":null,"action_taken":"test topics","status":"1","created_at":"2020-05-19 05:40:18","id":"364"},{"DT_RowId":"365","topic":"Some people have made the following statements about their food situation. Please answer whether the statements were OFTEN, SOMETIMES, or NEVER true for you and your household in the last 12 months. Within the past 12 months, you worried that your food would run out before you got money to buy more","notes":"Sometimes True","action_taken":null,"status":"1","created_at":"2020-05-19 07:27:00","id":"365"},{"DT_RowId":"366","topic":"Within the past 12 months, the food you bought just didn't last and you didn't have money to get more","notes":"Sometimes True","action_taken":null,"status":"1","created_at":"2020-05-19 07:27:00","id":"366"},{"DT_RowId":"367","topic":"What is your living situation today?","notes":"I have a place to live today, but I am worried about losing it in the future","action_taken":null,"status":"1","created_at":"2020-05-19 07:27:00","id":"367"},{"DT_RowId":"368","topic":"Think about the place you live. Do you have problems with any of the following? CHOOSE ALL THAT APPLY","notes":"Lead paint or pipes","action_taken":null,"status":"1","created_at":"2020-05-19 07:27:00","id":"368"},{"DT_RowId":"369","topic":"In the past 12 months has the electric, gas, oil, or water company threatened to shut off services in your home?","notes":"No","action_taken":null,"status":"1","created_at":"2020-05-19 07:27:00","id":"369"},{"DT_RowId":"282","topic":"Upcoming office visits","notes":null,"action_taken":"upcoming office visit","status":"1","created_at":"2020-05-11 19:26:25","id":"282"},{"DT_RowId":"286","topic":"Topices for next month","notes":null,"action_taken":"next month","status":"1","created_at":"2020-05-11 19:26:25","id":"286"},{"DT_RowId":"285","topic":"Annual screenings\/vaccinations?","notes":"test","action_taken":"test","status":"1","created_at":"2020-05-11 19:26:25","id":"285"},{"DT_RowId":"284","topic":"Preferred day\/time?","notes":null,"action_taken":"this is a test","status":"1","created_at":"2020-05-11 19:26:25","id":"284"},{"DT_RowId":"276","topic":"How often and how much have you been smoking?","notes":"I do not smoke.","action_taken":null,"status":"1","created_at":"2020-05-11 19:26:25","id":"276"},{"DT_RowId":"267","topic":"Do you get to talk to your grandkids often, what do you enjoy wathing on tv?","notes":"no. comments2 by CM","action_taken":null,"status":"1","created_at":"2020-05-11 13:42:49","id":"267"},{"DT_RowId":"277","topic":"Are you feelings depressed or sad?","notes":"Not today","action_taken":"test","status":"1","created_at":"2020-05-11 19:26:25","id":"277"},{"DT_RowId":"271","topic":"Greatest health concern","notes":null,"action_taken":"health concern actions","status":"1","created_at":"2020-05-11 19:26:25","id":"271"},{"DT_RowId":"268","topic":"Do you have reliable transportation getting to your appointments?","notes":"yes","action_taken":null,"status":"1","created_at":"2020-05-11 13:42:49","id":"268"},{"DT_RowId":"269","topic":"Do you still interact with your friends often?","notes":"yes","action_taken":null,"status":"1","created_at":"2020-05-11 13:42:49","id":"269"},{"DT_RowId":"265","topic":"What do you enjoy most about the holidays?","notes":"Roaming","action_taken":null,"status":"1","created_at":"2020-05-11 13:42:49","id":"265"},{"DT_RowId":"274","topic":"Are you following a healthy diet and eating well?","notes":"No, I do not follow a healthy diet or track my portion sizes.","action_taken":"test","status":"1","created_at":"2020-05-11 19:26:25","id":"274"},{"DT_RowId":"264","topic":"Are you looking forward to the holidays?","notes":"Yes","action_taken":"test holidays","status":"1","created_at":"2020-05-11 13:42:49","id":"264"},{"DT_RowId":"280","topic":"Do you suspect any apparent changes in patients mood or congnitive ability?","notes":"no","action_taken":null,"status":"1","created_at":"2020-05-11 19:26:25","id":"280"},{"DT_RowId":"278","topic":"How much alcohol have you had over the last month?","notes":"I do not drink.","action_taken":null,"status":"1","created_at":"2020-05-11 19:26:25","id":"278"},{"DT_RowId":"279","topic":"What exercises have you been doing over the last month?","notes":"Water Aerobics","action_taken":null,"status":"1","created_at":"2020-05-11 19:26:25","id":"279"},{"DT_RowId":"272","topic":"Have you fallen or had any dizzy spells recently","notes":"No","action_taken":null,"status":"1","created_at":"2020-05-11 19:26:25","id":"272"},{"DT_RowId":"266","topic":"Do you have any grandkids?","notes":"no. comments by CM","action_taken":"testing grandkids","status":"1","created_at":"2020-05-11 13:42:49","id":"266"},{"DT_RowId":"275","topic":"Do you feel well rested?","notes":"Yes, I do","action_taken":"testing rest row","status":"1","created_at":"2020-05-11 19:26:25","id":"275"},{"DT_RowId":"270","topic":"Last Month follow up","notes":"2020-05-14","action_taken":null,"status":"1","created_at":"2020-05-11 19:26:25","id":"270"}],"input":{"_":"1590831223757"}}

// On submit data
{"data":{"id":282,"action_taken":"upcoming","notes":null,"topic":"Upcoming office visits","DT_RowId":282}}

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

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

    Nothing obvious there. A test case would help, as tangerine requested, also a better description. When you say "doesn't work" - are you getting console errors? Is an update being sent to the server? Is it updating the field but on page refresh you lose the value?

    Colin

  • nivedita_keluskarnivedita_keluskar Posts: 4Questions: 1Answers: 0

    Yes the values are getting posted and saved. Just the row is not refreshed. My response format is:
    {"data":{"id":282,"action_taken":"upcoming","notes":null,"topic":"Upcoming office visits","DT_RowId":282}}

  • kthorngrenkthorngren Posts: 21,341Questions: 26Answers: 4,954

    According to the Editor Client Server Data exchange docs the row data should be in an array. More like this:

    {"data":
     [
      {"id":282,
       "action_taken":"upcoming",
       "notes":null,
       "topic":"Upcoming office visits",
       "DT_RowId":282}
     ]
    }
    

    Kevin

  • nivedita_keluskarnivedita_keluskar Posts: 4Questions: 1Answers: 0

    I tried with this format as well.
    I am getting following error in console:
    dataTables.editor.min.js:111 Uncaught TypeError: a is not a function

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

    Are you able to link to your page so we can take a look,

    Colin

  • nivedita_keluskarnivedita_keluskar Posts: 4Questions: 1Answers: 0
    edited June 2020

    I could fix the issue using different version of datatable and cdn file https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js. This worked on UAT Server but now on Production Server I am getting new issue.
    after submit it takes previous value and not the new value.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Please see Colin's last post.

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

    after submit it takes previous value and not the new value.

    If you refresh the page, does it have the new value then? And a link would be helpful to diagnose.

    Colin

This discussion has been closed.