extjs grid renderer參數用法

來源:互聯網
上載者:User

標籤:

今天在匯出EXT的二維時老是報錯,追進去看是renderer : function(value)的參數不對,經過一番研究,未免以後遇到再次浪費時間,記錄一下.

var cm = new Ext.grid.ColumnModel( [ new Ext.grid.RowNumberer({ header: "", width: 20, align: ‘center‘ }), { header: ‘‘, align: ‘center‘, dataIndex: ‘AccountAndRoseID‘, width: 50, sortable: true, hidden: true }, { header: ‘‘, align: ‘center‘, dataIndex: ‘UserAccountId‘, width: 50, sortable: true, hidden: true }, { header: ‘帳號‘, align: ‘center‘, dataIndex: ‘UserAccountName‘, width: 200, sortable: true }, { header: ‘角色名稱‘, align: ‘center‘, dataIndex: ‘UserRoleName‘, width: 200, sortable: true }, { header: ‘狀態‘, align: ‘center‘, dataIndex: ‘UserAccountStateId‘, width: 200, sortable: true, hidden: true, renderer: function() } ]

renderer可以格式化該列顯示的資料格式或者按照你自訂的指令碼顯示最終資料樣子(我目前是這麼理解的) 先看下renderer: function()裡的參數

renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){

} 1.value是目前的儲存格的值 2.cellmeta裡儲存的是cellId儲存格id,id不知道是幹啥的,似乎是列號,css是這個儲存格的css樣式。 3.record是這行的所有資料,你想要什麼,record.data["id"]這樣就獲得了。 4.rowIndex是行號,不是從頭往下數的意思,而是計算了分頁以後的結果。 5.columnIndex列號太簡單了。 6.store,這個厲害,實際上這個是你構造表格時候傳遞的ds,也就是說表格裡所有的資料,你都可以隨便調用,唉,太厲害了。

extjs grid renderer參數用法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.