【问题标题】:Codeigniter grocery crud set_relationCodeigniter 杂货杂货 set_relation
【发布时间】:2015-10-28 09:13:38
【问题描述】:

我正在尝试在以下代码中创建一个下拉列表:

 public function loadservices()
    {
        $crud = new grocery_CRUD();

            $crud->set_table('tbl_services');
            $crud->set_subject('Services');
$crud->set_relation('s_type','tbl_service_cat','service_desc');
 $crud->set_relation('s_country','tbl_country','country');
 $crud->set_relation('s_district','tbl_district','district');

            $output = $crud->render();
             $this->_admin_output($output);
             }

但是在这段代码中,数据被插入到了管理表中。但是,他们的 id 被插入到数据库中,而不是国家、州、地区。请为此问题提供合适的解决方案。 此外,我想获得 service_desc 的多选选项

$crud->set_relation('s_type','tbl_service_cat','service_desc');

【问题讨论】:

    标签: php codeigniter grocery-crud


    【解决方案1】:
    I want to sort the displaying table by two columns.Here is my code 
        public function e_counseling_mgt() {
            $counId = $this->session->all_userdata();
            $crud = new grocery_CRUD();
            $crud->set_theme('datatables');
            $crud->set_table('book_e_counseling_mst');
            $crud->set_subject('E-counseling');
            $crud->display_as('eemp_id', 'Employee Name')
                    ->display_as('ec_age', 'Date of Birth')
                    ->display_as('ec_marital', 'Marital Status')
                    ->display_as('ec_gender', 'Gender')
                    ->display_as('CaseId', 'Case ID')
                    ->display_as('flag', 'Case Status')
                    ->display_as('counseler_id', 'Counselor ID & Name')
    
                    ->display_as('ec_question4', 'In the last two weeks have you been feeling down ?')
                    ->display_as('ec_question5', 'Have you ever experieced voilence or abuse?')
                    ->display_as('ec_question6', 'Is there anything that you will be doing differently once your issue is resolved ?')
                    ->display_as('ec_question7', 'Please tell us a little bit about yourself, your education, your likes and dislikes ?')
                    ->display_as('ec_question8', 'Please describe your family background and anything else that you would like to share about your family ?')
                    ->display_as('ec_question9', 'If you were categorize your issue what broad category will it fall under according to you ?')
                    ->display_as('ec_question10', 'Please briefly describe the issue that you are facing currently. if you do not know what to say then just write whatever comes to mind and we will help you to take it forward from there by asking you more pointed questions ?')
                    ->display_as('ec_question11', 'Please share here what some effortes that you have already made to resolve your issue ?')
                    ->display_as('ec_question12', 'Any another comment that you want to share?')
                    ->display_as('ec_created_date', 'Date Of Registration');
    
    
    
            $crud->set_relation('flag', 'case_status_mstr', 'CaseStatusName', array('id !=' => '1'), 'CaseStatusName ASC');
            //$crud->set_relation('flag', 'case_status_mstr', 'CaseStatusName',array('flag' => 2));
            $crud->set_relation('counseler_id', 'users', '{EmpCode}-{name}', array('type' => 2, 'status' => '1', 'ProfileStatus' => '1'), 'EmpCode ASC');
          // $crud->set_relation('counselor_name', 'users', 'name');
            $crud->set_relation('eemp_id', 'end_employee_master', '{name} {lname}');
    
            $crud->columns('CaseId', 'flag', 'eemp_id', 'ec_age', 'ec_marital', 'ec_gender', 'ec_created_date', 'notifications');
            //$crud->required_fields('counselor_name');
            $crud->order_by('flag', 'desc');
    $crud->order_by('ec_created_date','desc');
            $crud->callback_column('notifications', array($this, 'notification_callback'));
            // $crud->unset_delete();
            $crud->unset_print();
            $crud->unset_add();
    
            $crud->where('counseler_id', $counId['logged_in']['id']);
    
            /* $crud->add_action('Feedback', 'http://www.grocerycrud.com/assets/uploads/general/smiley.png', 'counselor/counselor_home/EcounselingFeedback'); */
            $crud->add_action('Conversation', base_url().'images/smiley.png', 'counselor/counselor_home/EcounselingFeedback');
        $crud->order_by('flag', 'asc');
            $output = $crud->render();
            $output->bradcum = 'E-Counseling Cases';
            $output->ecou_css = 1;
            $this->_example_output($output);
    
            //function to when closing any case and reply to be sent for feed back
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-30
      • 2014-05-13
      • 2017-05-12
      • 2016-02-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多