English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Soluzione per il problema di non poter selezionare il checkbox (casella di controllo) in Extjs gridpanel in base alle condizioni di una riga

具体代码如下所示:

Ext.define('AM.view.test.ReceiptList', { 
  extend: 'Ext.grid.Panel', 
  alias: 'widget.receiptlist', 
  id : 'receiptlist', 
  selModel : {}} 
    selType : 'checkboxmodel', 
    mode : 'SIMPLE', 
    checkOnly : true, 
    renderer : function(v,p,record) { 
      if (record.data.XR0003 == '0') { 
        return '<div class="x-grid-row-checker"> </div>'; 
      }else{ 
        return ''; 
      } 
    } 
  , 
  listeners: { 
    beforeselect: function(grid, record, index, eOpts) { 
      if (record.get('XR0003')!=0) { 
        return false; 
      } 
    } 
  } 
}); 

Code Explanation:

1. The red标注 (annotation) is the key code;

2. The code in renderer indicates that the checkbox is displayed only when the conditions are met during rendering;

3. The code in listeners indicates that a condition judgment is made before selection, and it is not selected if it is not equal to 0;

4. You can combine the two methods according to your own needs.

The solution to the problem that the checkbox (checkbox) in Extjs gridpanel cannot be selected according to the conditions of a certain row is introduced to everyone by the editor, hoping it will be helpful to everyone. If everyone has any questions, please leave a message, and the editor will reply to everyone in time. At the same time, I would also like to express my sincere gratitude to everyone for supporting the Yana tutorial website!

Declaration: The content of this article is from the network, the copyright belongs to the original author, the content is contributed and uploaded by Internet users spontaneously, this website does not own the ownership, does not make manual editing, nor assume relevant legal liability. If you find any content suspected of copyright infringement, please send an email to: notice#oldtoolbag.com (when sending an email, please replace # with @) to report, and provide relevant evidence. Once confirmed, this site will immediately delete the content suspected of infringement.

Ti potrebbe interessare