Forum
18:12
10/12/2013
Is it possible to have edittype assigned based on value of another column? I have the following but it always returns edittype of text.
See the 'requestedchange' column.
<table id="list2"></table>
<div id="pager2"></div>
<script type="text/javascript">
$(document).ready(function(){
var selID = "";
var temp = "";
$("#list2").jqGrid({
url:'/QMSWebApp/DCRQueueServlet',
editurl:'/QMSWebApp/DCRIndexEditServlet',
datatype: "json",
height: "auto",
colNames:['Index#','Priority','Drawing#/Rev','Dwg Index#','Source','Requester','Request Date','Requested Change','Assigned To','Reject Request','Reason for Rejection','MngrAccess','EngAccess'],
colModel:[
{name:'id', index:'id', width:55, editable: true, editoptions:{ readonly:'readonly'}, editrules:{edithidden:true}, formoptions:{rowpos:1, colpos:1,label:"Index#:"},
cellattr: function(rowId, val, rawObject, cm, rdata){
if(rawObject.priority==1 && (rawObject.mngraccess || rawObject.engaccess)){return 'class="redBG editthis"';}
else if(rawObject.priority==1 && !rawObject.mngraccess && !rawObject.engaccess){return 'class="redBG printthis"';}
else if(rawObject.priority==2 && (rawObject.mngraccess || rawObject.engaccess)){return 'class="blueBG editthis"';}
else if(rawObject.priority==2 && !rawObject.mngraccess && !rawObject.engaccess){return 'class="blueBG printthis"';}
else if(rawObject.priority==3 && (rawObject.mngraccess || rawObject.engaccess)){return 'class="greenBG editthis"';}
else if(rawObject.priority==3 && !rawObject.mngraccess && !rawObject.engaccess){return 'class="greenBG printthis"';}
else if(rawObject.priority==4 && (rawObject.mngraccess || rawObject.engaccess)){return 'class="greenBG editthis"';}
else if(rawObject.priority==4 && !rawObject.mngraccess && !rawObject.engaccess){return 'class="greenBG printthis"';}
else{return 'class="printthis"';}}},
{name:'priority', index:'priority', width:55, hidden: true, editable: true, editrules:{edithidden:true}, formoptions:{rowpos:2, colpos:1,label:"Priority:"}, edittype: "select", editoptions: { size: 1}},
{name:'drawingno', index:'drawingno', width:125, editable: true, editoptions:{ readonly:'readonly'}, formoptions:{rowpos:3, colpos:1,label:"Drawing#:"}},
{name:'drawingid', index:'drawingid', width:90, hidden: true, editable: true, editrules:{edithidden:true}, formoptions:{rowpos:3, colpos:2,label:"See Dwg Index# :",elmsuffix: " for fix."}, edittype: "select", editoptions: { size: 1}},
{name:'source',index:'source', width:90, editable: true, editoptions:{ readonly:'readonly'}, formoptions:{rowpos:4, colpos:1,label:"Source:"}},
{name:'requester',index:'requester', width:120, editable: true, editoptions:{ readonly:'readonly'}, formoptions:{rowpos:5, colpos:1,label:"Requester:"}},
{name:'request_date',index:'request_date', width:90, editable: true, editoptions:{ readonly:'readonly'}, formoptions:{rowpos:6, colpos:1,label:"Date Requested:"}},
{name:'requestedchange',index:'requestedchange', width:200, hidden: true, editable: true, formoptions:{rowpos:7, colpos:1,label:"Requested Change:"}, editrules:{edithidden:true}, cellattr: function(rowId, val, rawObject, cm, rdata){if(rawObject.source=='FAI'){return "edittype: 'text', editoptions:{ rows: '3', cols: '50'}";}else{return "edittype: 'textarea'";}}},
{name:'responsibility',index:'responsibility', width:120, editable: true, formoptions:{rowpos:8, colpos:1,label:"Assigned To:"}},
{name:'rejectrequest',index:'rejectrequest', width:10, hidden: true, editable: true, editrules:{edithidden:true}, formoptions:{rowpos:9, colpos:1,label:"Reject Request:"}, edittype: "checkbox", editoptions:{ value: "1:0"}},
{name:'reasonforrejection',index:'reasonforrejection', width:10, hidden: true, editable: true, editrules:{edithidden:true}, formoptions:{rowpos:10, colpos:1,label:"Reason for Rejection:"}, edittype: "textarea", editoptions:{ rows: '3', cols: '50'}},
{name:'mngraccess',index:'mngraccess', width:90, hidden: true},
{name:'engaccess',index:'engaccess', width:90, hidden: true},
],
onSelectRow: oSelect,
rowNum:20,
rowList:[10,20,30],
loadonce: true,
pager: '#pager2',
viewrecords: true,
gridview: true,
loadComplete: lComplete,
caption:"Drawing Change Request Records"
});
$("#list2").jqGrid('delGridRow', selID);
$("#list2").jqGrid('navGrid','#pager2',{edit:true,add:false,del:true},{url:'/QMSWebApp/DCRIndexEditServlet', recreateForm: true, width: 700, viewPagerButtons: false},{url:'/QMSWebApp/DCRIndexAddServlet'},{});
function lComplete(){
};
function oSelect(id){
selID = id;
temp = $("#list2").getRowData(id)['drawingno'];
$("#list2").setColProp('drawingid', { editoptions: { dataUrl: '/QMSWebApp/DCRDrawingIndexListServlet?selecteditem=' + temp}});
$("#list2").setColProp('priority', { editoptions: { dataUrl: '/QMSWebApp/DCRPriorityOptionsListServlet'}});
$("#list2").setColProp('responsibility', { editoptions: {dataEvents: [{ type: 'click', fn: function(e) {findusername(this.name,'ALL'); } },]}});
};
function removenavbuttons(formid){
$("#pData, #nData", formid).hide();
};
//function afterpageClick(whichbutton, formid, rowid){
//temp = $("#list2").getRowData(rowid)['drawingno'];
//alert(whichbutton + ", "+ formid + ", " + rowid);
//$("#list2").setColProp('drawingid', { editoptions: { dataUrl: '/QMSWebApp/DCRDrawingIndexListServlet?selecteditem=' + temp}});
//$("tr#trv_id",formid[0]).getCol('drawingid');
//};
$('.exporttoexcel').on("click", function(){
alert("Export to Excel");
});
});
</script>
Most Users Ever Online: 715
Currently Online:
37 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66