4

I see the example in ExtJS, but it seems the checkColumn doesn't update the XML. The API is also not so helpful. What I wanted to do is something like this. When the user clicks the checkbox in the grid it will send an AJAX request.

hafizan
  • 41
  • 1
  • 1
  • 2

4 Answers4

8
columns: [{
        xtype: 'checkcolumn',
        width: 30,
        sortable: false,
        id: 'check1',
        dataIndex: 'check11',
        editor: {
            xtype: 'checkbox',
            cls: 'x-grid-checkheader-editor'
        },
        listeners: {
            checkchange: function (column, recordIndex, checked) {
                alert(checked);
                alert("hi");
            }
        }
    }
]

worked for me :)

urcm
  • 2,274
  • 1
  • 19
  • 45
Punith Raj
  • 2,164
  • 3
  • 27
  • 45
5

in extjs4 you can do this. there is the 'checkchange' event, so you can have something like this :

{
    header: 'State',
    dataIndex: 'STATE',
    xtype: 'checkcolumn',
    editor: {
        xtype: 'checkbox',
        cls: 'x-grid-checkheader-editor'
    },
    listeners: {
        checkchange: function(column, recordIndex, checked) {
            console.log(checked);
            //or send a request
        }
    }
}
scebotari66
  • 3,395
  • 2
  • 27
  • 34
0

You are going to want to fire the ajax request on the check change event. Or if you are trying to use the CheckboxSelectionModel in a grid put a listener on rowselect to fire off the ajax request.

sdavids
  • 1,527
  • 9
  • 11
0

if You are going to or want to fire the ajax request on the check change event. I think this will help for you.

columns: [{
    xtype: 'checkcolumn',
    width: 30,
    sortable: false,
    id: 'check1',
    dataIndex: 'check11',
    editor: {
        xtype: 'checkbox',
        cls: 'x-grid-checkheader-editor'
    },
    listeners: {
        checkchange: function (column, recordIndex, checked) {

            Ext.Ajax.request({
                url: 'abc.com/index.php',
                scope: this,
                params: { postData: postdata },
                method: 'POST',
                success: function (a) {

                }

                });
            }
    }
]
Vikas Hire
  • 588
  • 1
  • 20
  • 41