Advertisement
theolie

jappendo

Nov 14th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. <table class="appendo-gii" id="<?php echo $id ?>">
  2. <thead>
  3. <tr>
  4. <th align="left">Nama</th>
  5. </tr>
  6. </thead>
  7. <tbody>
  8. <?php if ($model->Nama == null): ?>
  9. <tr>
  10. <td><?php
  11. $dataProvider = new CActiveDataProvider('Karyawan3');
  12. $dataArray = $dataProvider->getData();
  13. $myarray = array();
  14. foreach ($dataArray as $data){
  15. array_push($myarray, CHtml::encode($data->Nama));
  16. }
  17.  
  18. $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
  19. 'model' => $model,
  20. 'id'=>'searcname',
  21. 'attribute' => 'Nama[]',
  22. 'source' => $myarray,
  23. 'options' => array(
  24. 'minLength' => '1',
  25. 'focus' => 'js:function( event, ui ) {
  26. $("#' . CHtml::activeId($model, 'Nama') . '").val(ui.item.label);
  27. return false;
  28. }',
  29. 'matcher'=>"js:function(item) {
  30. return ~item.toLowerCase().indexOf(this.query.toLowerCase());
  31. }",
  32. ),
  33. 'htmlOptions' => array(
  34. 'autocomplete' => 'off',
  35. 'placeholder' => 'Search Name',
  36. ),
  37. )); ?></td>
  38.  
  39. </tr>
  40. <?php else: ?>
  41. <?php for($i = 0; $i < sizeof($model->Nama); ++$i): ?>
  42. <tr>
  43. <td>
  44. <?php
  45. $dataProvider = new CActiveDataProvider('Karyawan3');
  46. $dataArray = $dataProvider->getData();
  47. $myarray = array();
  48. foreach ($dataArray as $data){
  49. array_push($myarray, CHtml::encode($data->Nama));
  50. }
  51.  
  52. $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
  53. 'model' => $model,
  54. 'id'=>'searcname',
  55. 'attribute' => 'Nama[]',
  56. 'source' => $myarray[$i],
  57. 'options' => array(
  58. 'minLength' => '1',
  59. 'focus' => 'js:function( event, ui ) {
  60. $("#' . CHtml::activeId($model, 'Nama') . '").val(ui.item.label);
  61. return false;
  62. }',
  63. 'matcher'=>"js:function(item) {
  64. return ~item.toLowerCase().indexOf(this.query.toLowerCase());
  65. }",
  66. ),
  67. 'htmlOptions' => array(
  68. 'autocomplete' => 'off',
  69. 'placeholder' => 'Search Name',
  70. ),
  71. )); ?>
  72. </td>
  73.  
  74. </tr>
  75. <?php endfor; ?>
  76. <tr>
  77. <td>
  78. <?php
  79. $dataProvider = new CActiveDataProvider('Karyawan3');
  80. $dataArray = $dataProvider->getData();
  81. $myarray = array();
  82. foreach ($dataArray as $data){
  83. array_push($myarray, CHtml::encode($data->Nama));
  84. }
  85.  
  86. $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
  87. 'model' => $model,
  88. 'id'=>'searcname',
  89. 'attribute' => 'Nama[]',
  90. 'source' => $myarray,
  91. 'options' => array(
  92. 'minLength' => '1',
  93. 'focus' => 'js:function( event, ui ) {
  94. $("#' . CHtml::activeId($model, 'Nama') . '").val(ui.item.label);
  95. return false;
  96. }',
  97. 'matcher'=>"js:function(item) {
  98. return ~item.toLowerCase().indexOf(this.query.toLowerCase());
  99. }",
  100. ),
  101. 'htmlOptions' => array(
  102. 'autocomplete' => 'off',
  103. 'placeholder' => 'Search Name',
  104. ),
  105. )); ?>
  106. </td>
  107. </tr>
  108. <?php endif; ?>
  109. </tbody>
  110. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement