如何使用列模式修复ngx数据表列宽为'force'

时间:2020-10-20 09:53:13

标签: typescript bootstrap-4 angular8 ngx-datatable column-width

im使用ngx数据表。在那个即时通讯没有列。默认情况下,它花了很多功夫,并且它比带有滚动条的网格还多。我尝试了宽度的列数组。

export default (state = DEFAULT_STATE, action) => {
    switch (action.type) {
        case SET_USER_ENTRY:
            return {
                beers: action.entry[0].beers,
                totalScore: action.entry[0].totalScore || 'TBC'
      };
      case DELETE_USER_ENTRY:
            return {
                beers: {},
                totalScore: 'TBC'
      };
        default:
            return state;
    }
};

我的桌子是

  displayColumns = [
    { name: 'S.No', value: 'SNo', width: '10' }, { name: 'Item', value: 'ProductName' , width: '10'  },
    { name: 'HSN Code', value: 'HCNCode', width: '10'  }, { name: 'GST%', value: 'GSTRate', width: '100'  },
    { name: 'Touch', value: 'PTouch', width: '10'  },
    { name: 'Qty', value: 'Quantity', width: '10'  }, { name: 'MCP Rate', value: 'MCPRate', width: '10'  }, 
    { name: 'MCP Amt', value: 'MCPAmount', width: '10'  },
    { name: 'Weight', value: 'Weight', width: '10'  }, { name: 'MCG Rate', value: 'MCGRate', width: '10'  },
     { name: 'MCG Amt', value: 'MCGAmount', width: '10'  },
    { name: 'Wastage', value: 'STouch', width: '10'  }, { name: 'Purity', value: 'Purity', width: '10'  }, { name: 'Total MC', value: 'TotalMC', width: '10'  },
    { name: 'Gram Rate', value: 'Rate', width: '10'  }, { name: 'Total Amt', value: 'TotalAmount' , width: '10' },
    { name: 'Actions', value: 'Actions' }];

width不能在column数组中指定。我越来越像波纹管 actually grid having like this

并期待像波纹管这样的网格 expecting grid

如图所示,期望网格具有可拖动的标题..因此,在这种情况下,您能否说出如何固定列宽。我尝试了许多无法解决的方法。

1 个答案:

答案 0 :(得分:0)

如果我正确理解了您的问题,则希望为列设置固定宽度。我会这样:

  [1]: https://i.stack.imgur.com/GDScm.png
  [2]: https://i.stack.imgur.com/ZnXbe.png
  [3]: https://i.stack.imgur.com/flf0n.png