我有以下要求。我只需要使用oracle-jet oj-table :
- 在页面加载组织数据上加载了不同的角色
雇员。需要将此数据绑定到OJ-Table,将行分组为
员工角色(例如经理,人力资源等)
- 应在第一列中使用复选框启用行选择。单身的
&需要多个选择。
- 组标头行还应具有复选框,选择哪个
选择该组中的所有员工。
示例代码或示例或任何参考链接是高度应用的。
谢谢
I have below requirement. I only need to use oracle-jet oj-table:
- On page load organization data is loaded with different roles of
employees. Need to bind this data to oj-table, with rows grouped on
employee role (like manager, HR etc..)
- Row selection should be enabled with checkbox in first column. Single
& multiple selection needed.
- Group header row should also have the checkbox, selecting which
selects all the employees in that group.
Sample code or examples or any reference links are highly appriciated.
Thanks
发布评论
评论(1)
oj-table 。
要检查一个/所有行,以下是一种方法:
查看:
模型:
如果您有按钮或其他内容,则可以单击回调,可以在其中可以通过
const inds = self获得所选ID。 SelectedIDS();
。请注意,可能有更好的方法可以做到这一点,但是,总而言之:
selectedids
),并且每个复选框都具有代表实体的ID通过那行;可观察到的boolean>
,订阅其值并使用上述名称更新所有复选框的值(selecteds selectedIds
);编辑:
这里有一个
There are plenty of example in Oracle JET cookbook on how to bind data to an
oj-table
.For checking one/all rows, here is one way to do it:
View:
Model:
If you have a button or something, you can then have a click callback where you can have your selected IDs by
const ids = self.selectedIDs();
.Note that there are probably better ways to do this, but, in summary:
selectedIds
in the example) and each of them having the ID of the entity represented by that row;Observable<boolean>
, subscribe to its value and update the value of all checkboxes with the above name (selectedIds
);EDIT:
There is a Cookbook example for (multi)selection, which is waaaaay easier than my hacky approach.