Forum



17:31

08/07/2012

What's the best approach to hiding the Delete icon for each row (inline edit mode) that meets a set criteria/condition? The grid (below) has 4 columns per row and I want to hide the Delete icon if one of the columns ("Effective Date" which is a date field populated via a date picker) meets my set condition.
a) What event do I hook into to do this on initial load and each time the user edits the Effective Date column?
jQuery("#agencyGrid").jqGrid({
url: dataUrl,
datatype: "json",
mtype: "POST",
colNames: ['SEQ#', 'Agency', 'Effective Date', 'Expiration Date', ''],
colModel: [
{ name: 'sequence', index: 'sequence', width: 25, resizable: false, editable: false },
{ name: 'agency', index: 'agency', width: 200, editable: true, resizable: false, edittype: "select", editoptions: { dataUrl: '@Url.Action("GetAgenciesForGrid")'} },
{ name: 'effectiveDate', index: 'effectiveDate', width: 150, editable: true, resizable: false,
editoptions: { size: 20, dataInit: function (el)
{ $(el).datepicker({ dateFormat: 'mm/dd/yy' }); },
defaultValue: function () {
var currentTime = new Date();
var month = parseInt(currentTime.getMonth() + 1);
month = month <= 9 ? "0" + month : month;
var day = currentTime.getDate();
day = day <= 9 ? "0" + day : day;
var year = currentTime.getFullYear(); return month + "/" + day + "/" + year;
}
}
},
{ name: 'expirationDate', index: 'expirationDate', width: 150, align: "right", editable: true, resizable: false,
editoptions: { size: 20, dataInit: function (el)
{ $(el).datepicker({ dateFormat: 'mm/dd/yy' }); },
defaultValue: function () {
var currentTime = new Date();
var month = parseInt(currentTime.getMonth() + 1);
month = month <= 9 ? "0" + month : month;
var day = currentTime.getDate();
day = day <= 9 ? "0" + day : day;
var year = currentTime.getFullYear(); return month + "/" + day + "/" + year;
}
}
},
{ name:'action', index:'action', width: 50, sortable:false, resize: false, formatter:'actions'}
],
rowNum: 10,
rowList: [10, 20, 30],
pager: '#agencyGrid_pager',
sortname: 'effectiveDate',
viewrecords: true,
sortorder: "desc",
editurl: editUrl,
width: 800,
height: 200
}).navGrid("#agencyGrid_pager",
{ refresh: false, add: true, edit: false, del: false },
{}, // settings for edit
{width: 'auto', url: addUrl }, // settings for add
{width: 'auto', url: '' }, // settings for delete
{sopt: ["cn"]} // Search options. Some options can be set on column level
);
Most Users Ever Online: 715
Currently Online:
30 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