public function actionList() { $admin = new AdminListAutocomplete(OphTrOperationnote_PostopSiteSubspecialtyDrug::model(), $this); $admin->setListFields(array('id', 'postopdrugs.name', 'default')); $admin->setCustomDeleteURL('/oeadmin/PostOpDrugMappings/delete'); $admin->setCustomSaveURL('/oeadmin/PostOpDrugMappings/add'); $admin->setCustomSetDefaultURL('/oeadmin/PostOpDrugMappings/setDefault'); $admin->setCustomRemoveDefaultURL('/oeadmin/PostOpDrugMappings/RemoveDefault'); $admin->setModelDisplayName('Per-operative Drugs Mapping'); $admin->setFilterFields(array(array('label' => 'Site', 'dropDownName' => 'site_id', 'defaultValue' => Yii::app()->session['selected_site_id'], 'listModel' => Site::model(), 'listIdField' => 'id', 'listDisplayField' => 'short_name'), array('label' => 'Subspecialty', 'dropDownName' => 'subspecialty_id', 'defaultValue' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'listModel' => Subspecialty::model(), 'listIdField' => 'id', 'listDisplayField' => 'name'))); // we set default search options if ($this->request->getParam('search') == '') { $admin->getSearch()->initSearch(array('filterid' => array('subspecialty_id' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'site_id' => Yii::app()->session['selected_site_id']))); } $admin->setAutocompleteField(array('fieldName' => 'drug_id', 'jsonURL' => '/oeadmin/PostOpDrugMappings/search', 'placeholder' => 'search for adding per op drug')); //$admin->searchAll(); $admin->listModel(); }