Permalink
Browse files

set new autocomplete options when connectionId chages

  • Loading branch information...
1 parent 72c2498 commit 2686ca3e5fbc3b860755c412d97f3406c8ff7cfc @mdomba mdomba committed Aug 17, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 framework/gii/generators/model/views/index.php
@@ -1,6 +1,17 @@
<?php
$class=get_class($model);
Yii::app()->clientScript->registerScript('gii.model',"
+$('#{$class}_connectionId').change(function(){
+ var tableName=$('#{$class}_tableName');
+ tableName.autocomplete('option', 'source', []);
+ $.ajax({
+ url: '".Yii::app()->getUrlManager()->createUrl('gii/model/getTableNames')."',
+ data: {db: this.value},
+ dataType: 'json'
+ }).done(function(data){
+ tableName.autocomplete('option', 'source', data);
+ });
+});
$('#{$class}_modelClass').change(function(){
$(this).data('changed',$(this).val()!='');
});

0 comments on commit 2686ca3

Please sign in to comment.