Issue with editing a textarea field

Issue with editing a textarea field

amila charithamila charith Posts: 2Questions: 1Answers: 0
edited July 2019 in Free community support

Hi , when i use render property to to display a txtare properly in my table ,but now when i try to edit a records ,a data in that text area doesn't show my code
to create datatable fields

           columns: [
               {data: 'id', name: 'id'},
               {data: 'tour_name', name: 'tour_name'},
               {data: 'description',
                name: 'description',
                render: function ( data, type, row ) {
                    return "<textarea  name='description' id='description' >"+data+"</textarea>";
                }  
                },
               {data: 'no_of_days', name: 'no_of_days'},
               {data: 'cost', name: 'cost'},
               {data: 'action', name: 'action', orderable: false, searchable: false},
                   ]

jQuery code for editing

 $('body').on('click', '.editPackage', function () {
      var pak_id = $(this).data('id');
      $.get("{{ route('packages.index') }}" +'/' + pak_id +'/edit', function (data) {
       // console.log( data);
         $('#userCrudModal').html("Edit Package");
          $('#saveBtn').val("edit-package");
          $('#ajax-crud-modal').modal('show');
          $('#id').val(data.id);
          $('#tour_name').val(data.tour_name);
          $('#description').val(data.description);
          $('#no_of_days').val(data.no_of_days);
          $('#cost').val(data.cost);
      })
   });

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

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @amila charith ,

    When you say 'edit', are you using Editor? If not, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • amila charithamila charith Posts: 2Questions: 1Answers: 0

    Hi @colin , my issue is when i include additional information for a column ( in this case render attribute and function ) that column ( in my case text-area field) doesnt get picked up by jQuery ,is ther way to fix this ( obeviously i need to modify my jQuery code bu i dont know what to include ) Thanks .

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    As I said, we're happy to take a look if you post a test case.

This discussion has been closed.