Edit mode not selected value appearing

Edit mode not selected value appearing

crackwoodcrackwood Posts: 2Questions: 1Answers: 0
edited March 2019 in Free community support

Hi . When I select a datatable row and click edit, the values that I selected on the table do not appear in the fields of the edit form . The first element of the select list appear, but I want the actual field selected in the table . Could anyone help me ? Here is my code

 editor = new $.fn.dataTable.Editor({
            ajax: "",
            table: "#commandes_affectation",
            idSrc: 'id',
            fields: [
              
                { label: "Nom :", name: "nom_outlook", type: "select", options: html2 },
                { label: "Role :", name: "role", type: "select", options: html},
              
                { label: "Date de début :", name: "debut_date", type: "date" },
                { label: "Date de fin :", name: "fin_date", type: "date"}
            ],
          
          
        });

    
    
           $('#commandes_affectation').DataTable({
            
            type: "GET",
            dataType: "json",
      
            
                language: DATATABLE_FR,
                ajax: 
                     {url:"",dataSrc:""},
                   
                
                columns: [
                  
                    { "data": "nom_outlook" },
                    { "data": "role" },
                   

                    { "data": "debut_date" },
                    { "data": "fin_date" }
                ],
                responsive: true,
      paging: false,
      scrollCollapse: true,
      bFilter: false,
      select:true,

            });

            new $.fn.dataTable.Buttons( $('#commandes_affectation').DataTable(), [
           
                { extend: "create", editor: editor },
                { extend: "edit",   editor: editor },
                { extend: "remove", editor: editor },
          
            ]);

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @crackwood ,

    At a glance your code looks ok - pretty much the same as this example here. Are your variables html and html2 formatted the same as the example? If no joy, would you be able to link to your page or create a test case?

    Cheers,

    Colin

This discussion has been closed.