Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






How to hide the delete icon per row per a set criteria (inline edit mode)

UserPost

17:31
08/07/2012


XhiXhi

New Member

posts 2

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
         );


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

92 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9590

Posts: 28781

Membership:

There are 10158 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1157

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (7009 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information