我在网格中遇到问题,我想做一些像column A
这样的操作,column B
这两个都是字符串值的下拉列表,我想在{{two
中使用这个column C
值1}}使用data(single value)
从datebase中获取Query
。你能告诉我如何获得two column values
到third column
以及如何在第三列中执行操作以使用两个列值从数据库中获取数据。请提前帮助我。
这是我的代码
<div class='wrapper' align="center">
<table id="jqGrid" ></table>
<div id="jqGridPager" ></div>
</div>
<script>
$('#appweek').on('change', function (event) { alert('Applicable Date Changed'); $('#jqGrid').trigger("reloadGrid"); });
function myelem (value, options) {
var el = document.createElement("input");
el.type="text";
el.value = $("#appweek option:selected" ).text();
return el;
}
function myvalue(elem, operation, value) {
if(operation === 'get') {
return $(elem).val();
} else if(operation === 'set') {
$('input',elem).val(value);
}
}
$("#jqGrid").jqGrid({
url:'server.php',
editurl: 'add.php',
datatype: "json",
shrinkToFit: true,
colNames:['REQUEST NO','Employee_Login','Applicable Date','Change_Type','New_Value','Existing_Value','Requestor NOTES','Status'],
colModel:[
{name:'ID', index:'ID',align:"center"},
{name:'Employee_Login', index:'Employee_Login', align:"center",editable:true,editrules: { required: true},edittype:'select',editoptions:{dataUrl:'el.php'}},
{name:'applicable_date', index:'applicable_date', align:"center",hidden:true,editable:true,editrules: {required: true},edittype:'custom', editoptions:{readonly: true,custom_element: myelem, custom_value:myvalue}},
{name:'Change_Type', index:'Change_Type', align:"center",editable:true,editrules: { required: true},edittype:'select', editoptions: { value: "WeekNo:WeekNo; WeekBeginning:WeekBeginning; SITE:SITE; WFH:WFH; ManagerLogin:ManagerLogin; Lead:Lead; CostCenter:CostCenter; Business_Title:Business_Title; Function:Function; WorkGroup:WorkGroup; LoginTime:LoginTime; ROLE:ROLE; SecondarySkill:SecondarySkill; WeekOff:WeekOff;"}},
{name:'New_Value', index:'New_Value', align:"center",editable:true,editrules: { required: true}},
{name:'Existing_Value', index:'Existing_Value', align:"center",editable:true,editrules: { required: true},edittype:'select',editoptions:{dataUrl:'ex.php'}},
{name:'Requestor_NOTES', index:'Requestor_NOTES', align:"center",editable:true,edittype:'textarea', editoptions: {rows:"2",cols:"10"}},
{name:'Status', index:'Status', align:"center",editable:false},
],
rowNum:200,
rowList:[400,300,200],
pager: '#jqGridPager',
sortorder: "asc",
sortname:'id',
viewrecords: true,
height:'500',
width:'1000',
});
jQuery("#jqGrid").jqGrid('navGrid',"#jqGridPager",{edit:false,del:false,search:false,add:false});
jQuery("#jqGrid").jqGrid('inlineNav',"#jqGridPager");
</script>