CodeIgniter Forums

Full Version: master & detail grid using jqgrid ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
hi everyone..

my plan is to use jqgrid in my CI project..and so far i have done with some standard jqgrid with (add,edit,search), but no luck in using master and detail grid..

anybody has success implement master & detail grid using jqgrid in codeigniter ?

please share your experience or code ? Smile


thanks in advance

El Forum

[eluser]RaviDalal[/eluser]
Yes, I Have Solution.....
I have worked through your post.....and yes i have done it.....
The Changes i have made in model itself....coz you were writing count() function wrongly..

Any ways take my Model Code.....Just Put It

<?php
Class Model_grid extends CI_Model
{
function __construct()
{
parent::__construct();
//Setting input field to declared variables
$this->gridmasterid = $this->input->post('master_id');
$this->gridmastername = $this->input->post('master_name');
$this->gridchildname = $this->input->post('child_name');
}

function countallgriddata()
{
$this->db->select("*");
$this->db->from("invheader");
$query = $this->db->get();
$data = $query->num_rows();
return $data;
}

function countallsubgriddata($id)
{
/*
echo $id;
$this->db->select("*");
$this->db->from("invlines");
//$query = $this->db->get_where('invheader',array('id' => $id));
$query = $this->db->where_in('invheader',array('id' => $id));
$data = $query->num_rows();
return $data;
*/

//print_r($id);die;
$this->db->select('*');
$this->db->from('invlines');
$this->db->where('id',$id);
$query = $this->db->get();
$data = $query->num_rows();
return $data;

}

/*function insert_master_data()
{
$data = array(
'master_name' => $this->gridmastername
);
$this->db->insert('invheader',$data);
echo $this->db->last_query();die;
}

function insert_child_data()
{
$data = array(
'child_name' => $this->gridchildname
);
$this->db->insert('invlines',$data);
echo $this->db->last_query();die;
}

function edit_data($id)
{
$data = array(
'user_name' => $this->gridusername
);
$this->db->where('user_id', $id);
$this->db->update('uname', $data);
echo $this->db->last_query();die;
}

function delete_data($id)
{
$this->db->where('user_id',$id);
$this->db->delete('uname');

echo $this->db->last_query();die;
}*/

public function gridAll($sidx,$sord,$limit,$start)
{
$data = "";
$this->db->select("*");
$this->db->from("invheader");
$this->db->order_by($sidx,$sord);
$this->db->limit($limit,$start);
$Q = $this-> db-> get();
if ($Q-> num_rows() > 0){
$data=$Q-> result();
}
$Q-> free_result();
return $data;
//echo $this->db->last_query();die;
}

public function gridAllDetail($ids,$sidx,$sord,$limit,$start)
{
//echo 'test'+$ids;
//$data = "";
//$id_invoice = $this->input->post($ids);

$this->db->select("*");
$this->db->from("invlines");
$this->db->where("id",$ids);
$this->db->order_by($sidx,$sord);
$Q = $this-> db-> get();
if ($Q-> num_rows() > 0){
$data=$Q-> result();
}
//$Q-> free_result();
return $data;
}
}
?>

El Forum

[eluser]Unknown[/eluser]
dear,

Based on the ION's problem, how to make master detail with two or more parameter..

i've tried some ways, example like this

jQuery("#list_invoice_detail").jqGrid('setGridParam',{url:'index.php/invoice_controller/grid_detail/'+ ids +kasus_id,page:1});

but...did not display anything...

thanks