Jqgrid Pass选择行列值为dataurl

时间:2014-07-26 21:16:58

标签: php jquery jqgrid

我正在尝试将列值传递给php,根据列值加载编辑表单上的选择项。

dataUrl:'includes/Opera_classif.php?Op=local&id=' +ID +Description +id_local

JS

mtype: 'GET', 
colNames: [ "ID","Descrição","ID Local", "Local","Select Local"],
colModel: [
{name:'ID',index:'ID', width:20, sorttype:"int"},
{name:'Description',index:'Description', width:150, editable: true,editrules:{required:true}},
{name:'id_local',index:'id_local',hidden:true, width:20, editable: true,editrules:{required:true}},
{name:'Local_Description',index:'Local_Description', width:100, editable: true,editrules:{required:true}},
{
    name:'escolhe_local',index:'escolhe_local', width:80,resizable:true, hidden:true, editrules:{edithidden: true }, 
    align:"left",sorttype:"text",editable:true,edittype:"select",
    editoptions:{dataUrl:'includes/Opera_classif.php?Op=local'} 
}

1 个答案:

答案 0 :(得分:0)

可以使用dataUrl定义为函数(请参阅herehere)。函数dataUrl得到3个参数(第一个是rowid,第二个是当前列的值 - 在您的情况下是Local_Description),this将被初始化为网格的DOM(例如,您可以使用$(this).jqGrid("getRowData", rowid)$(this).jqGrid("getCell", rowid, "Description"))。通过这种方式,您可以生成所需的任何dataUrl值。