2014-10-07 91 views
0

我有一個SQL viewphpmyadmin其中有一個用於填充使用jquery jtable創建的表中的數據。這個問題非常奇怪,因爲只有一列被視圖拖動的數據沒有被顯示,並且所有其他數據都沒有顯示出來。編輯字段時也沒有問題,我可以看到我在phpmyadmin中所做的更改。我如何獲得成功的列顯示?所有的幫助非常感謝。來自sql視圖的單個列的數據不顯示

截圖表中的

enter image description here

js它處理表的創建

function getLessonsLearnedResponseChildTable(ContainerID) { 
var table = { 
    title: '', 
    width: '5%', 
    sorting: false, 
    edit: false, 
    create: false, 
    display: function(data) { 
     //create an image to be used to open child table 
     var $img = $('<img src="' + config.base_url + 'assets/images/expand_row-small.png" title="View Responses" style="height:30px;width:30px;cursor:pointer;" height="30" width="30"/>'); 
     $img.click(function() { 
      $('#' + ContainerID).jtable('openChildTable', 
        $img.closest('tr'), 
        { 
         title: data.record.event,// + ' - Response Plans' 
         actions: { 
          listAction: config.base_url + "data_fetch/responses/" + data.record.risk_id, 
          deleteAction: config.base_url + 'data_fetch/delete_response/', 
          updateAction: config.base_url + 'data_fetch/edit_response/' 
         }, 
         messages: defaultResponseMessages, 
         fields: LessonsLearnedResponseFields 
        }, function(data) {//opened handler 
       data.childTable.jtable('load'); 
      }); 
     }); 
     //return image to show on row 
     return $img; 
    } 
}; 
return table; 
} 

控制器方法的的listAction:

function responses($risk_id = null, $offset = 0, $limit = 100, $order_by = 'response_id', $direction = 'ASC') { 
    $confirm_member = $this->User_model->confirm_member(true, false); 
    if (!$confirm_member['success']) { 
     $this->print_jtable_error(self::ERROR_NOT_LOGGED_IN); 
     return; 
    } 
    $user_id = $_SESSION['user_id']; 
    $this->load->model('Response_model'); 
    $responses = $this->Response_model->get_all($risk_id, $user_id, $limit, $offset, $order_by, $direction); 
    if ($responses == false) { 
     $this->print_jtable_error(self::ERROR_NO_ACCESS_PERMISSION); 
     return; 
    } else { 
     return $this->print_jtable_result($responses); 
    } 
} 

get_all方法在的sql view

enter image description here

/* 
* Retrieves all responses associated with the risk 
*/ 

public function get_all($risk_id, $user_id, $limit = null, $offset = 0, $order_by = null, $direction = 'ASC') { 
    //load risk model to check if user can read from project 
    $this->load->model('Risk_model'); 
    if ($this->Risk_model->initialize($risk_id, $user_id) == false) { 
     return false; 
    } 
    if ($limit !== null && $limit != 0) { 
     $this->db->limit($limit, $offset); 
    } 
    if ($order_by !== null) { 
     $this->db->order_by($order_by, $direction); 
    } 
    $query = $this->db->select('SQL_CALC_FOUND_ROWS *', false)->from('view_responses')->where('risk_id', $risk_id)->get(); 
    $data = $query->result_array(); 
    $this->load->model('Task_model'); 
    foreach ($data as &$response) 
     $response['WBS'] = $this->Task_model->normalize_WBS($response['WBS']); 
    $data['num_rows'] = $this->db-> 
        query('SELECT FOUND_ROWS()', false)->row(0)->{'FOUND_ROWS()'}; 
    return $data; 
} 

截圖被接收,但不顯示

http://imgur.com/MqCVAGm

+1

請問您可以發佈視圖的定義和一些示例數據,它們應該呈現您沒有收到的輸出? – jpw 2014-10-07 22:00:50

+1

沒有代碼,沒有幫助。問題的圖片是無用的。 – 2014-10-07 22:04:56

回答

0

我已經能夠解決這個問題。這是拼寫問題。我從SQL視圖中獲得了成功的缺失c,現在工作正常。

相關問題