Method for jQuery plug in EasyUI to set checkbox of datagrid to disabled state

  • 2021-07-09 06:47:35
  • OfStack

This article illustrates how the jQuery plug-in EasyUI sets checkbox of datagrid to a disabled state. Share it for your reference, as follows:

The method is simple, we only need to handle it in the event after the data is loaded successfully. The specific code is as follows:


// Events 
onLoadSuccess: function (data) {
  // Data after successful loading of simulation test Id Greater than 20 Check and disable all of the checkbox
  for (var i = 0; i < data.rows.length; i++) {
    if (data.rows[i].Id > 20) {
      dgObj.datagrid('checkRow', i);
      // Disable checkbox
      $(".datagrid-row[datagrid-row-index=" + i + "] input[type='checkbox']")[0].disabled = true;
    }
  }
}

Description:

Where dgObj is a table object, such as:


$('#tableId')

For more readers interested in jQuery related content, please check the topics of this site: "Summary of jQuery Extension Skills", "Summary of jQuery Common Plug-ins and Usage", "Summary of jQuery Drag Effects and Skills", "Summary of jQuery Table (table) Operation Skills", "Summary of Ajax Usage in jquery", "Summary of jQuery Common Classic Special Effects", "Summary of jQuery Animation and Special Effects Usage" and "Summary of jquery Selector Usage"

I hope this article is helpful to everyone's jQuery programming.


Related articles: