如何从easyui数据网格中获取所有数据

问题描述 投票:4回答:1

我曾尝试使用getData例如

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

可能会导致:总数正确,如100记录但是返回的行仅获得当前页面行,例如25行。我需要获取所有记录(100行)。

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

datagrid jquery-easyui
1个回答
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;  
    }
© www.soinside.com 2019 - 2024. All rights reserved.