1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    2
    Vote Rating
    0
    dkgemini is on a distinguished road

      0  

    Default How do I add a listener to a CheckColumn?

    How do I add a listener to a CheckColumn?


    Hi there

    I am using a CheckColumn (plugin) in an EditorGridPanel. It updates fine with the info from my database (i.e. it shows checked/unchecked depending on the values 1 or 0 in the database). The problem comes when I check or uncheck the checkbox - the change doesn't get updated in the database. Changes to the other fields work just fine, it is just the checkbox that I can't seem to make work.

    I have a feeling I have to use a different listener than afteredit (checkchange probably), but I can't figure out how.

    I hope someone can help me.

    Here's a some of my code, hopefully someone can help me - I am very green when it comes to Ext JS.

    Code:
    var checkColumn = new Ext.grid.CheckColumn({
            header: 'State funded',
            dataIndex: 'is_state_funded',
            width: 100,
            });
    
    var grid = new Ext.grid.EditorGridPanel({
    
    .. code left out ...
    
     columns: [
                    {header: "ID", dataIndex: 'id', id: 'id', width: 35},
                    {header: "School Name", dataIndex: 'school_name', id: 'school_name', editor: school_name_edit, width: 220},
                    {header: "School Type", dataIndex: 'school_type', renderer: school_type_name, editor: school_type_edit, width:100},
            checkColumn
                ],
                }),
                sm: new Ext.grid.RowSelectionModel({
                    singleSelect: true
                }),
                listeners: {
                    afteredit: function(e){
                        Ext.Ajax.request({
                            url: 'schools-update.php',
                            params: {
                                action: 'update',
                                id: e.record.id,
                                field: e.field,
                                value: e.value
                            },
                            success: function(resp,opt) {
                                e.record.commit();
                            },
                            failure: function(resp,opt) {
                                e.record.reject();
                            }
                        });
                    }
                },
    
    ... code left out ...

  2. #2
    Sencha User
    Join Date
    Jul 2009
    Posts
    88
    Vote Rating
    1
    Ash2009 is on a distinguished road

      0  

    Default


    the listener onMouseDown is already added to the Ext.grid.CheckColumn class.check/uncheck is handled there.

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    2
    Vote Rating
    0
    dkgemini is on a distinguished road

      0  

    Default


    Thanks for that. I am still not sure how to do that... I ended up solving the problem in a different way.

Thread Participants: 1

Tags for this Thread