Peter Kellner
Peter Kellner

Reputation: 15508

Needing Code For ExtJS 4 renderer for checkbox column in Ext.Grid.Panel

I've been wrestling with how to make the column show as a checkbox (non-editable one).

Any Suggested code for the renderer? Seems like there should be a simple config option, but I can't find it.

 Ext.define('AEDT.view.EmailListByAddressEntry', {
     extend: 'AEDT.view.ui.EmailListByAddressEntry',
     alias: 'widget.emaillistbyaddressentry',

     initComponent: function () {
         var me = this;
         me.callParent(arguments);
     },

     onCheckBoxWhilteListOnlyChange: function (field, newValue, oldValue, options) {
         //debugger
         if (newValue) {

             this.store.filter("WhiteList", true);
             store.filter();
         } else {
             this.store.clearFilter();
         }
     },
     onBooleancolumnRender: function (abstractcomponent, options) {

     }
 });

Upvotes: 0

Views: 4921

Answers (2)

Eric
Eric

Reputation: 7005

I noticed your comment on the Ext.grid.column.Boolean page. Anyway, the description of the renderer config states that the return value is "a HTML string to be rendered". So it seems to me that the following should work (simplified for brevity):

renderer: function(value) {
    var text = '<input type="checkbox" disabled="disabled"';
    if(value) {
        text += ' checked="checked"';
    }
    return text + '/>';
}

Upvotes: 1

Neil McGuigan
Neil McGuigan

Reputation: 48297

Why don't you use the checkbox plugin?

http://docs.sencha.com/ext-js/4-0/#!/example/grid/grid-plugins.html

Upvotes: 0

Related Questions