Extensions
- Data Extensions
- Form Extensions
- JQuery Tricks
Form design - Complex dynamic rows
Not really an extension, but simple jquery trick based on HTML layout.
View code
<div class="complex"> <span class="label"> <?php echo Yii::t('ui', 'Persons'); </span> <div class="panel"> <table class="templateFrame grid" cellspacing="0"> <thead class="templateHead"> <tr> <td> <?php echo $form->labelEx(Person::model(),'firstname'); </td> <td> <?php echo $form->labelEx(Person::model(),'lastname'); </td> <td colspan="2"> <?php echo $form->labelEx(Person::model(),'eyecolor_code'); </td> </tr> </thead> <tfoot> <tr> <td colspan="4"> <div class="add"><?php echo Yii::t('ui','New');</div> <textarea class="template" rows="0" cols="0"> <tr class="templateContent"> <td> <?php echo CHtml::textField('Person[{0}][firstname]','',array('style'=>'width:100px')); </td> <td> <?php echo CHtml::textField('Person[{0}][lastname]','',array('style'=>'width:100px')); </td> <td> <?php echo CHtml::dropDownList('Person[{0}][eyecolor_code]','',Lookup::items('eyecolor'),array('style'=>'width:100px','prompt'=>'')); </td> <td> <div class="remove"><?php echo Yii::t('ui','Remove');</div> <input type="hidden" class="rowIndex" value="{0}" /> </td> </tr> </textarea> </td> </tr> </tfoot> <tbody class="templateTarget"> <?php foreach($persons as $i=>$person): <tr class="templateContent"> <td> <?php echo $form->textField($person,"[$i]firstname",array('style'=>'width:100px')); </td> <td> <?php echo $form->textField($person,"[$i]lastname",array('style'=>'width:100px')); </td> <td> <?php echo $form->dropDownList($person,"[$i]eyecolor_code",Lookup::items('eyecolor'),array('style'=>'width:100px','prompt'=>'')); </td> <td> <div class="remove"><?php echo Yii::t('ui','Remove'); </td> </tr> <?php endforeach; </tbody> </table> </div><!--panel--> </div><!--complex-->
Browse code
/js/jquery.format.js
/js/template.js

Visual Yii