如何从easyui datagrid获取所有数据

时间:2014-10-20 10:25:07

标签: datagrid jquery-easyui

我曾尝试使用getData例如

data = $("#dg").datagrid("getData");`
var total = data.total; (total is 100)`
var rows = data.rows; (rows.length is 25)`

可能会导致:总数与100条记录一样正确 但行返回只获取当前页面行,如25行。 我需要获取所有记录(100行)。

我错过了什么吗?或者我们怎么做?请帮帮我。

1 个答案:

答案 0 :(得分:0)

这是由于分页。让我用分页描述模型以在php中显示100行。

function get_invoiceinfoList($search_keyword,$custID){

    $page = 1;
    $rows = 100;
    $sort = '';
    $order = 'asc';
    $offset = ($page - 1) * $rows;

        if($custID > 0  && $search_keyword == 0){ 
            $search = " and a.customer_id =$custID";  
        }else{  
         $search = "and (b.name like '%$search_keyword%' || a.inv_no like '%$search_keyword%')" ; 
        }

        $vQuery=$this->db->query("SELECT a.inv_id,a.inv_no,a.inv_org,a.inv_date,
            a.customer_id,a.heading,a.quot_id,a.total_cost as total_amount,
            a.paid_amount,(a.total_cost-a.paid_amount)as due_amount,b.name
            from  sales_invoice a,view_customer_info b
            where
            a.customer_id = b.customer_id $search order by a.inv_date DESC limit $offset, $rows");

        $result = $vQuery->result();
        $rows = array();

    foreach ($result as $rowData){
        array_push($rows, $rowData);
    }
    $data['rows'] = $rows;

    return $data;  
    }