php - Yii2 add/remove rows in GridView -
i using gridview list data in application today realized need dynamicalli add/remove rows to/from list. found javascript not elegant. googled extension or module karje's gridview extension ther aren't much. use kind of task or think simpliest way make this?
i tried unclead/yii2-multiple-input package. great instead of activeform need use html::dopdownlist elements. way somehow use it?
<tbody> <?= $form->field($megrendelt_r, 'termek_id')->widget(\unclead\widgets\multipleinput::classname(), [ 'limit' => 6, ]) ?> </tbody>
thank answers!
using jquery
$(document).ready(function(e) { var $table = $('#gridviewid table tbody'); //gridviewid = grid view 'id' var $rows = $table.find('tr'); var rownum = $rows.size(); var columnsnum = $($rows[0]).find('td').size(); for(var = 0; < rownum; i++) { var $row = $($rows[i]); //add row after $($row).after('<tr><td colspan='+ columnsnum +'>lore ipsum</td></tr>'); } });
Comments
Post a Comment