Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table class="appendo-gii" id="<?php echo $id ?>">
- <thead>
- <tr>
- <th align="left">Nama</th>
- </tr>
- </thead>
- <tbody>
- <?php if ($model->Nama == null): ?>
- <tr>
- <td><?php
- $dataProvider = new CActiveDataProvider('Karyawan3');
- $dataArray = $dataProvider->getData();
- $myarray = array();
- foreach ($dataArray as $data){
- array_push($myarray, CHtml::encode($data->Nama));
- }
- $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
- 'model' => $model,
- 'id'=>'searcname',
- 'attribute' => 'Nama[]',
- 'source' => $myarray,
- 'options' => array(
- 'minLength' => '1',
- 'focus' => 'js:function( event, ui ) {
- $("#' . CHtml::activeId($model, 'Nama') . '").val(ui.item.label);
- return false;
- }',
- 'matcher'=>"js:function(item) {
- return ~item.toLowerCase().indexOf(this.query.toLowerCase());
- }",
- ),
- 'htmlOptions' => array(
- 'autocomplete' => 'off',
- 'placeholder' => 'Search Name',
- ),
- )); ?></td>
- </tr>
- <?php else: ?>
- <?php for($i = 0; $i < sizeof($model->Nama); ++$i): ?>
- <tr>
- <td>
- <?php
- $dataProvider = new CActiveDataProvider('Karyawan3');
- $dataArray = $dataProvider->getData();
- $myarray = array();
- foreach ($dataArray as $data){
- array_push($myarray, CHtml::encode($data->Nama));
- }
- $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
- 'model' => $model,
- 'id'=>'searcname',
- 'attribute' => 'Nama[]',
- 'source' => $myarray[$i],
- 'options' => array(
- 'minLength' => '1',
- 'focus' => 'js:function( event, ui ) {
- $("#' . CHtml::activeId($model, 'Nama') . '").val(ui.item.label);
- return false;
- }',
- 'matcher'=>"js:function(item) {
- return ~item.toLowerCase().indexOf(this.query.toLowerCase());
- }",
- ),
- 'htmlOptions' => array(
- 'autocomplete' => 'off',
- 'placeholder' => 'Search Name',
- ),
- )); ?>
- </td>
- </tr>
- <?php endfor; ?>
- <tr>
- <td>
- <?php
- $dataProvider = new CActiveDataProvider('Karyawan3');
- $dataArray = $dataProvider->getData();
- $myarray = array();
- foreach ($dataArray as $data){
- array_push($myarray, CHtml::encode($data->Nama));
- }
- $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
- 'model' => $model,
- 'id'=>'searcname',
- 'attribute' => 'Nama[]',
- 'source' => $myarray,
- 'options' => array(
- 'minLength' => '1',
- 'focus' => 'js:function( event, ui ) {
- $("#' . CHtml::activeId($model, 'Nama') . '").val(ui.item.label);
- return false;
- }',
- 'matcher'=>"js:function(item) {
- return ~item.toLowerCase().indexOf(this.query.toLowerCase());
- }",
- ),
- 'htmlOptions' => array(
- 'autocomplete' => 'off',
- 'placeholder' => 'Search Name',
- ),
- )); ?>
- </td>
- </tr>
- <?php endif; ?>
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement