Forum
09:23
17/12/2009
hi,
im currently working with the master/detail grid but i have a problem with when i select a row in the master grid..it don't show the details i have in the details grid..
this is the view of my master grid..
this is the detail grid with a blank data after i select the row 3 in my master grid..
i have here the script for the master/detail grid..i'm using CodeIgniter.. here's the link for my code in CI : http://codeigniter.com/forums/.....ad/143099/
$(".listFlex").jqGrid({
url: root + mod + '/listview',
editurl: root + mod + '/post',
sortable: true,
datatype: "json",
mtype: 'POST',
colNames:['','Username','Lastname', 'Firstname','Middle Initial'],
colModel:[
{name:'user_id', index: 'item', hidden: true},
{name:'username',index:'username', width:80, align:"left", editable:true},
{name:'last_name', index: 'last_name', width:80, editable: true},
{name:'first_name',index:'first_name', width:100,align:"left",editable:true},
{name:'middle_initial', index: 'middle_initial', width:80, editable: true}
],
rowNum:10,
rowList:[10,20,30],
rownumbers: true,
pager: '#pager',
sortname: 'username',
viewrecords: true,
sortorder: 'asc',
autowidth: true,
ondblClickRow: function (celDiv,id)
{
//alert (id);
$(celDiv).addClass("pointer");
$(celDiv).click(function(){
$('.toolbar a[title=Header]').trigger('click');
viewdb(id);
});
},
height: "200",
caption:"User Role List -Dean",
onSelectRow: function(rowid, selected)
{
if(rowid != null) {
//jQuery("#detFlex1").jqGrid('setGridParam',{postData:{user_id:rowid}});
jQuery("#detFlex1").setGridParam({url: root + mod + '/detaillistview',page:1})
.setCaption("Detail: "+rowid)
jQuery("#detFlex1").trigger("reloadGrid");
$('.toolbar a[title=Header]').trigger('click');
viewdb(rowid);
//viewHeader(rowid, selected);
}
}
});
$("#detFlex1").jqGrid({
url: root + mod + '/detaillistview',
datatype: "json",
mtype: 'POST',
colNames:['','Company Code','Company Name', ''],
colModel:[
{name:'company_access_id', index: 'company_access_id', hidden: true},
{name:'company_code',index:'company_code', width:250, align:"left", editable:true},
{name:'company_name', index: 'company_name', width:250, editable: true},
{name:'company_id',index:'company_id', hidden: true}
],
rowNum:10,
rowList:[10,20,30],
rownumbers: true,
sortname: 'company_code',
viewrecords: true,
pager: '#pager1',
sortorder: 'asc',
autowidth: true,
height: "100",
caption:"Details"
});
hope you can help me..
regards,
kahtrina
-Simple is Hard-
16:47
Moderators
30/10/2007
Hello,
The true test is to test your server side code. - Also see what parameters are passed to the detail and try to simulate these in the SQL console - you will see the result.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
04:01
17/12/2009
tony said:
Hello,
The true test is to test your server side code. - Also see what parameters are passed to the detail and try to simulate these in the SQL console - you will see the result.
Best Regards
Tony
here's my code where it save the details about the company...
function getDetailList() //Show the list of registered user with company details
{
$item = $this->input->post("item"); #<-- this line don't post the value of the $item that's why there's no details showing in the detail grid even when you select a row from the master grid
$page = $this->input->post('page');
$limit = $this->input->post('rows');
$sidx = $this->input->post('sidx');
$sord = $this->input->post('sord');
$query = $this->input->post('query');
$qtype = $this->input->post('qtype');
if (!$sidx) $sidx = 'sec_companyaccess.user_id';
if (!$sord) $sord = 'desc';
if (!$page) $page = 1;
if (!$limit) $limit = 25;
$start = (($page-1) * $limit);
$this->db->start_cache();
$this->db->join('maint_company','sec_companyaccess.company_id=maint_company.company_id','left');
$this->db->join('sec_users ','sec_companyaccess.user_id=sec_users.user_id','left');
$this->db->from('sec_companyaccess');
$this->db->where("sec_companyaccess.user_id", $item);
$count = $this->db->count_all_results();
if( $count > 0 && $limit > 0) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit * $page - $limit; // do not put $limit*($page - 1)
if($start <0) $start = 0;
$this->db->select("sec_companyaccess.company_access_id as pkey,sec_companyaccess.company_access_id, maint_company.company_code, maint_company.company_name,sec_companyaccess.company_id ");
$this->db->order_by($sidx,$sord);
$this->db->limit($limit, $start);
$query = $this->db->get("sec_companyaccess");
$this->db->flush_cache();
$data['db'] = $query;
$data['page'] = $page;
$data['totalpages'] = $total_pages;
$data['totalrecords']=$count;
return $data;
}
note:
$this->db->where("sec_companyaccess.user_id", $item); // but when i change the value of $item here to values 1 or 2 the detail grid is showing the company detail
hope you can help me...
-Simple is Hard-
08:19
Moderators
30/10/2007
Hello,
This is a PHP code and not Java Script code related to the grid.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
61 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66