gqgrid ajax data load on edit
i have jqgrid with the following structure :
jQuery("#frmac").jqGrid({
url:'manage_groups_controller.php?module=group',
datatype: "json",
colNames:[ ' ' , 'Id', 'Pays' , 'Category', 'SubCategory','Hidden','Group name','Title', 'Libelle','Etat', 'Pds'],
colModel:[
{name: 'myac', width:100, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}},
{name:'id', key : true, index:'id',width:50},
{name:'country',index:'country_id' ,edittype:'select', editoptions:{value:{32:'Belgique',1000:'Canada',33:'France', 352:'Luxembourg',41:'Suisse'}},width:50 , editable :true},
{name:'category', index:'category_id', editable :true,width:80,edittype:'select',editoptions: {dataUrl:'manage_groups_controller.php?module=category',dataEvents :[{ type: 'change', fn: function(e) {var thisval = $(e.target).val();$.get('manage_groups_controller.php?module=subcat&catid='+thisval, function(data){$("#subcategory_id").html(data);});}}]}},
{name:'subcategory',index:'subcategory_id', editable :true,width:100,edittype:'select',editoptions: {dataUrl:'manage_groups_controller.php?module=subcat&catid='}},
{name:'hidden',index:'hidden',width:60,edittype:'select', editable :true,editoptions:{value:{O:'Oui',N:'Non'}}},
{name:'group',index:'nom_group',width:250},
{name:'title',index:'title',width:300,editable:true, edittype:'textarea',editoptions: {rows:"5",cols:"27"},editrules:{required:true}},
{name:'libelle', index:'libelle',width:300,editable:true, edittype:'textarea',editoptions: {rows:"5",cols:"27"},editrules:{required:true}},
{name:'etat', index:'etat', editable :true,width:30,edittype:'select', editoptions:{value:{A:'Active',D:'Desactive'}}},
{name:'pds', index:'pds', editable :true,width:30,editrules:{required:true},formatter:'integer'}
],
rowNum:10, width:700,
rowList:[10,20,30],
pager: '#pfrmac',
sortname: 'id',
viewrecords: true,
sortorder: "asc",
jsonReader: { root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: true,
cell: "cell"
} ,
caption: "Gestion des groupes",
height: '100%',
width: '100%',
editurl : 'manage_groups_controller.php?module=group'
});
jQuery("#frmac").jqGrid('navGrid','#pfrmac',{edit:false,add:true,del:false});
i have two somes problemes with inline edit on the rows Category and SubCategory:
1- when a categroy op开发者_如何学Pythontion selected the subcategory slectbox must be populated with option related to the category selectBox, the $.get function work fine , but i don't find how to put returned html to the Subcategory row.
2- on edit of the subcategory row i have to populate the select box with option related the the current category option , i can't find how to to pass the value to editoptions: {dataUrl:'manage_groups_controller.php?module=subcat&catid= ?????????'}
精彩评论