Jqgrid将选择行列值传递给dataurl [英] Jqgrid Pass select rows column values to dataurl

查看:307
本文介绍了Jqgrid将选择行列值传递给dataurl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将列值传递给php,以基于列值将选择项加载到编辑表单上.

I'm trying to pass column values to php load the select item on the edit form based on the column values.

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'} 
}

推荐答案

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

One can use dataUrl defined as function (see here and here). The function dataUrl get 3 parameter (the first is the rowid, the second is the value from the current column - Local_Description in your case) and this will be initialized to DOM of the grid (so you can use $(this).jqGrid("getRowData", rowid) or $(this).jqGrid("getCell", rowid, "Description") for example). In the way you can generate any dataUrl value which you need.

这篇关于Jqgrid将选择行列值传递给dataurl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆