4

I had try to use the getData e.g.

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

It can result: the total number is correct like 100 records but the rows return only get the current page rows like 25 rows. I need to get all of the records (100 rows).

Is there something i missed ? Or how can we do this ? Please help me.

Community
  • 1
  • 1
Jerry Lee
  • 59
  • 1
  • 6

1 Answers1

0

This is because of pagination. let me describe model with pagination for showing 100 row in php.

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;  
    }
Dipta Das
  • 402
  • 3
  • 8