簡體   English   中英

Extjs checkColumn

[英]Extjs checkColumn

我在ExtJS中看到了這個例子,但似乎checkColumn沒有更新XML。 API也沒那么有用。 我想做的是這樣的事情。 當用戶單擊網格中的復選框時,它將發送AJAX請求。

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");
            }
        }
    }
]

為我工作:)

在extjs4中你可以做到這一點。 有'checkchange'事件,所以你可以這樣:

{
    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
        }
    }
}

您將要在檢查更改事件上觸發ajax請求。 或者,如果您嘗試在網格中使用CheckboxSelectionModel,則在rowselect上放置一個偵聽器以觸發ajax請求。

如果您打算或想要在檢查更改事件上觸發ajax請求。 我認為這對你有所幫助。

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) {

                }

                });
            }
    }
]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM