2

我正在从事一个项目,其中 IU 是在CxReact的基于前端的框架中完成的。https://cxjs.io/
我有一个网格,每列顶部都有过滤字段。
例如,这是数字列和字段:

{
    field: 'score', sortable: true,
    header: {
        style: 'width: 150px',
        items: <cx>
            <div>
                Score
                <br />
                <NumberField style="width:100%;margin-top:5px" value:bind="$page.filter.score"
                    reactOn="enter blur"/>
            </div>
        </cx>
    },
},

但是价值在左边,我需要它在右边。我希望网格和过滤器字段值都在右侧,但将列名保留在左侧。就像它通常在 Excel 中一样。另外如何设置自定义小数位数,例如 2?

4

1 回答 1

2

NumberField小部件允许通过inputStyle. 格式化是使用format. 网格列标题可以仅使用style.

考虑到所有这些,它应该是这样的:

{
    field: "score",
    sortable: true,
    header: {
      style: "width: 150px; text-align: left",
      items: (
        <cx>
          <div>
            Score
            <br />
            <NumberField
              value:bind="$page.filter.score"
              format="n;2"
              style="width:100%;margin-top:5px"
              inputStyle="text-align: right"
              reactOn="enter blur"
            />
          </div>
        </cx>
      )
    }
  }
于 2017-04-12T08:14:43.810 回答