Добавление строк с выпадающим списком в datatable плагин в JavaScript не работает - PullRequest
0 голосов
/ 02 ноября 2019

Я пытаюсь добавить выпадающий список в datatable плагине в javascript, я сделал кнопку, чтобы можно было автоматически добавить строку, а затем, пока я пытаюсь поставить выпадающий список, это не работает, пожалуйстаПомогите. Вот мой код

Кнопка добавления

              <table id="thistable_data" class="display nowrap" width="100%">
           <thead>
            <tr>
                          <th>Product ID</th>
                          <th>Product Name</th>
                          <th>Qty</th>
                          <th>Unit Cost</th>
                          <th>Accounts</th>
                          <th>Unit</th>
                          <th>Total Cost</th>

                      </tr>
                  </thead>
                  <tbody>
              </tbody>
              </table>

А вот мой JavaScript

`

` $ (документ) .ready (function () {

var td = $('#thistable_data').DataTable();
var count = 1;
function b(a)

{return a

    ? (            



      a ^            
      Math.random()  
      * 16          
      >> a/4        
      ).toString(16)
    : (             
      [1e7] +       
      -1e3 +        
      -4e3          

      ).replace(    
        /[018]/g,   
        b            
      )
}

function b (a) {

return a?

(a ^ Math.random ()* 16 >> a / 4) .toString (16): ([1e7] + - 1e3 + -4e3) .replace (/ [018] / g, b)

} ​​

    $('#btnadd').on( 'click', function () {

        td.row.add( [

          b(),


          ' <input class="" type="text" name="prodname[]" > ',

          ' <input class="" type="text" name="qty[]" > ',

          ' <input class="" type="text" name="prc[]" > ',

            '<select class="ptacc"><option>this is the problem<option></select>',

              ' <input class="" type="text" name="unc[]" > '  ,

            ' <input class="" type="text" name="totc[]" > '    ,

    ] ).node().id = 'thisid' + count;
        td.draw( false );
        td.search('');
        count++;
    } );

} );

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...