Welcome Guest, Not a member yet? Register   Sign In
some trouble with jqgrid
#2

[eluser]teddy[/eluser]
I found some errors in my code and everything is ok, but I am seeking some tutorials about master detail with jqgrid I did it but subgrid is not show is nothing just show text loading...

My js script
Code:
$(function()
    {

            jQuery("#list").jqGrid({              
                url:'<?=$base_url.'index.php/admin/users/list_users'?>',            
                editurl:'<?=$base_url.'index.php/admin/users/crud'?>',
                datatype: "json",  
                mtype : "post",                    
                colNames:['id','Họ tên','username','Email','Ngày đăng ký','Active'],
                colModel:[
                    {name:'id', index:'id', width:55,hidden:true},
                    {name:'hoten',index:'hoten', width:100, align:"left",sortable:true,editable:true},
                    {name:'username',index:'username', width:150, align:"left",search:true,sortable:true,editable:true},                
                    {name:'Email',index:'email', width:100, align:"right",search:true,sortable:true},
                    {name:'date_added', index:'date_added'
                        ,formatter:'date', formatoptions: {newformat:'d-m-Y H:i:s'}
                        , align:'center',search:true,sortable:true},

                    {name:'Active',index:'active', width:100, align:"right",search:true,sortable:true
                        ,edittype:'checkbox',editoptions: { value:"True:False" }
                        ,formatter: "checkbox", formatoptions: {disabled : false},align:'center'},    
                
                ],
                rowNum:10,
                width: 750,
                height: 300,
                rowList:[10,20,30],
                pager: '#pager',
                sortname: 'id',
                viewrecords: true,
                rownumbers: true,
                loadonce:true,
                gridview: true,
                multiselect:true,
                caption:"Danh sách Users",
                subGrid:true,        
                subGridUrl:'<?=$base_url.'index.php/admin/users/getDetails'?>',
                subGridModel: [{ name : ['tieude','date_added'], width : [200,55], params:['user_id']} ]
            });
    
      
   $("#list").jqGrid('navGrid', '#pager', { edit: false,add: false,  del: true, });
    jQuery("#list").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false});    
    jQuery("#list").jqGrid('inlineNav',"#pager");
    
});

and here is my subgrid controller

Code:
function getDetails()
{
  $id=$_POST['id'];    
  $sql="select * from tbl_posts where user_id='$id'";
  $rs=$this->db->query($sql)->result_array();
    

  $i=0;
  foreach($rs as $row) {
   $responce->rows[$i]['id']=$row->id;
   $responce->rows[$i]['cell']=array($row->id,$row->tieude,$row->date_added);
   $i++;
      }

   echo json_encode($responce);

}


Messages In This Thread
some trouble with jqgrid - by El Forum - 11-08-2012, 11:10 AM
some trouble with jqgrid - by El Forum - 11-09-2012, 07:30 AM
some trouble with jqgrid - by El Forum - 11-09-2012, 08:15 AM
some trouble with jqgrid - by El Forum - 01-11-2013, 09:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB