Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
How to enable/disable checkbox in jqgrid based on some condition
02/03/2010
23:41
Avatar
alps
New Member
Members
Forum Posts: 2
Member Since:
03/03/2010
sp_UserOfflineSmall Offline

How to enable/disable checkbox in jqgrid based on some condition, I have mod_flag if it has data value 'Y' then enable otherwise disable

thanks

03/03/2010
04:54
Avatar
lupin
Member
Members
Forum Posts: 28
Member Since:
12/02/2010
sp_UserOfflineSmall Offline

You can disable by doing.

$(#ur_checkbox_id) .attr('disabled', true);

But there must be some events that need to toggle it on that.

hth,

lupin

03/03/2010
16:58
Avatar
alps
New Member
Members
Forum Posts: 2
Member Since:
03/03/2010
sp_UserOfflineSmall Offline

I think I need to explain in more detail: below is my jqgrid

          jQuery(document).ready(function() {
             jQuery("#list").jqGrid({
                 url: '<%=Url.Action("", "") %>',
                 datatype: 'json',
                 mtype: 'POST',
                 colNames: ['IdNr', 'Agency Num', 'Clear', 'N/C Code', 'Description', 'Date Cleared',"Modify Flag"],
                 colModel: [
             { name: 'AGN_NUM', index: 'AGN_NUM', editable: false, hidden:true},
           { name: 'AGN_NUM', index: 'AGN_NUM', editable: false, hidden:true},
           { name: 'clr_flag', index: 'clr_flag', width: 60, align: 'center', editable: true, edittype:"checkbox", editoptions:{value:'1:0'}, formatter:"checkbox", formatoptions:{disabled:false},sortable:false},          
          { name: 'NON_CMPL_CD', index: 'NON_CMPL_CD', width: 75, align: 'left', editable: false },
          { name: 'NON_CMPL_DESC', index: 'NON_CMPL_DESC', width: 250, align: 'left', editable: false},
          { name: 'DATE_CLR', index: 'DATE_CLR', width: 80, align: 'left', editable: false},
          { name: 'MODIFY_ROW_FLAG', index: 'MODIFY_ROW_FLAG', editable: false, hidden:true}
          ],
                 pager: '',
                 rowNum: -1,
                 rowList: [5, 10, 20, 50],
                 sortname: 'AGN_FY',
                 sortorder: 'asc',
                 altRows: true,
                 emptyrecords: "Nothing to display",
                 viewrecords: true,
                 imgpath: '<%=Url.Content("~/scripts/themes/basic/images")%>',
                 caption: '',
                 cellEdit: true,
                 cellsubmit: 'clientArray',
                 height: 275,
                 gridview: true  
             }).navGrid(pager, { edit: false, add: false, del: false, refresh: true, search: false }, { navkeys: [true, 38, 40] }, {}, { url: "/Mileage/Delete" });
         });

I want to disable the checkbox on the grid load based on value hidden column (MODIFY_ROW_FLAG)value (Y/N) if possible.

if it is not possible on grid load then any other way , please advise

04/03/2010
04:25
Avatar
lupin
Member
Members
Forum Posts: 28
Member Since:
12/02/2010
sp_UserOfflineSmall Offline

Ok there's a dataEvents option you can you use on MODIFY_RAW_FLAG column here's mine just a sample:

dataEvents: [
               {  type: 'change',fn: function(e) {
                var ccode = $('#MODIFY_RAW_FLAG').val();
                if ( ccode == "Y" ) {
                    alert(ccode);
                     $('#tr_clr_flag').attr('disabled',true);
                                     }
                if ( ccode == "N" )
                {
                    alert(ccode);
                     $('#tr_clr_flag').attr('disabled',false);
                }
               } } ]

Above code is untested, you might need to tweak a bit to your liking and true/false might need to be change to disable,enable or something, alert was there just to make sure the events are being fired.

hth,

lupin

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
21 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information