3

有没有办法自定义 rowEditor 按钮?我的意思是是否可以更改图像或添加文本。如果不可能,有没有办法通过按钮或链接等其他控件获得相同的行为?

4

2 回答 2

11

只需使用 CSS。下面的示例假设您要将其应用于所有数据表/行编辑器,并在/resources/images文件夹中拥有所需的图像文件。

.ui-datatable .ui-row-editor .ui-icon-pencil {
    background-image: url("#{resource['images/pencil.png']}");
}

.ui-datatable .ui-row-editor .ui-icon-check {
    background-image: url("#{resource['images/check.png']}");
}

.ui-datatable .ui-row-editor .ui-icon-close {
    background-image: url("#{resource['images/close.png']}");
}

也可以看看:

于 2013-02-14T12:22:25.330 回答
1

此外,如果您想使用“Font Awesome”中的 fa-icons,您可以从 font-awesome.css 复制分配给它们的粘贴类。

.ui-datatable table tbody tr td .ui-row-editor .ui-icon-pencil 
{
   background: none !important;
   text-indent: initial;
   /* display: inline-block; */
   font: normal normal normal 14px/1 FontAwesome;
   font-size: inherit;
   text-rendering: auto;
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
   transform: translate(0, 0);
}
.ui-datatable table tbody tr td .ui-row-editor .ui-icon-pencil:before {
   content: "\f044";
}
.ui-datatable table tbody tr td .ui-row-editor .ui-icon-pencil:hover {
   font-weight: bold;
}
于 2015-11-25T16:35:35.347 回答