2013-10-19 55 views
0

我有三個依賴的dropboxes,選擇第三個選項後,會有一個表格生成,並且表格的每一行都有刪除鏈接,將所有下拉列表替換爲表格內容,但新的下拉列表已損失了Ajax功能 再生代碼如下Drupal 7 - 依賴Ajax的下拉框和表格

$form['ajax_fieldset'] = array(
            '#type' => 'fieldset', 
            '#prefix' => '<div id="ajax_data_wrapper">', 
            '#suffix' => '</div>', 
); 


$form['ajax_fieldset'] = array(
              '#type' => 'fieldset', 
// These provide the wrapper referred to in #ajax['wrapper'] above. 
              '#prefix' => '<div id="ajax_data_wrapper" style="">', 
              '#suffix' => '</div>', 
); 


$form['ajax_fieldset']['country_select'] = array(
         '#type' => 'select', 
         '#title' => t('Country List'), 
         '#options' => $countries_list, 
         '#ajax' => array(
            'wrapper' => 'ajax_data_wrapper', 
            'callback' => 'get_country_select_callback', 

), 
); 



$form['ajax_fieldset']['lang_select'] = array(
         '#type' => 'select', 
         '#title' => t('Language List'), 
         '#options' => array(), 
); 



$form['ajax_fieldset']['audio_select'] = array(
           '#type' => 'select', 
           '#title' => t('Audio List'), 
           '#options' => array(), 
); 


$table_data_1=table_creater($urls[2]); 

$form['ajax_fieldset']['library_table']=$table_data_1; 
$commands = array(); 
$commands[] = ajax_command_replace("#ajax_data_wrapper", render($form['ajax_fieldset'])); 

回答

0

不得不使用ajax_deliver()方法如下,

$commands = array(); 
$commands[] = ajax_command_replace("#selected_audio_wrapper", render($form['selected_audio_fieldset'])); 
$commands[] = ajax_command_invoke(NULL, "call_from_ajax", array("")); 
$page = array('#type' => 'ajax', '#commands' => $commands); 
ajax_deliver($page);