Word-wrap grid cells in Ext JS

后端 未结 6 1836
野性不改
野性不改 2020-12-24 12:17

(This is not a question per se, I\'m documenting a solution I found using Ext JS 3.1.0. But, feel free to answer if you know of a better solution!)

The Colu

6条回答
  •  眼角桃花
    2020-12-24 12:49

    If you only want to apply the wrapping to one column, you can add a custom renderer.

    Here is the function to add:

    function columnWrap(val){
        return '
    '+ val +'
    '; }

    Then add the renderer: columnWrap to each column you want to wrap

    new Ext.grid.GridPanel({
    [...],
    columns:[{   
         id: 'someID',
         header: "someHeader",
         dataIndex: 'someID',
         hidden: false,
         sortable: true,
         renderer: columnWrap           
    }]
    

提交回复
热议问题