- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在使用数据表 Row Group创建一个分为多个部分的表的功能。
但是,我想将分隔部分向右对齐(见下文)
我正在尝试通过使用 text-align:right 实现此结果;如 this question 中所述, 但使用 text-align:right 似乎不起作用
请参阅下面的代码和 here for my jsfiddle
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href='https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css' rel='stylesheet' />
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/jszip-2.5.0/dt-1.10.16/af-2.2.2/b-1.5.1/b-colvis-1.5.1/b-flash-1.5.1/b-html5-1.5.1/b-print-1.5.1/cr-1.4.1/fc-3.2.4/fh-3.1.3/kt-2.3.2/r-2.2.1/rg-1.0.2/rr-1.2.3/sc-1.4.4/sl-1.2.5/datatables.min.css"
/>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src='https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js'></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs/jszip-2.5.0/dt-1.10.16/af-2.2.2/b-1.5.1/b-colvis-1.5.1/b-flash-1.5.1/b-html5-1.5.1/b-print-1.5.1/cr-1.4.1/fc-3.2.4/fh-3.1.3/kt-2.3.2/r-2.2.1/rg-1.0.2/rr-1.2.3/sc-1.4.4/sl-1.2.5/datatables.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/ashl1/datatables-rowsgroup/fbd569b8768155c7a9a62568e66a64115887d7d0/dataTables.rowsGroup.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-12">
<table id="example" class="display" style="width:100%">
</table>
</div>
</div>
</div>
<script>
data = [{
DT_RowId: "row_1",
first_name: "Garrett",
position: "Accountant",
email: "g.winters@datatables.net",
office: "New York",
extn: "8422",
},
{
DT_RowId: "row_2",
first_name: "Chris",
position: "Accountant",
email: "g.winters@datatables.net",
office: "New York",
extn: "8422",
},
{
DT_RowId: "row_3",
first_name: "Tiger",
position: "Analyst",
email: "g.winters@datatables.net",
office: "New York",
extn: "8422",
},
{
DT_RowId: "row_4",
first_name: "Bob",
position: "Analyst",
email: "g.winters@datatables.net",
office: "Tokyo",
extn: "8422",
}]
table = $("#example").DataTable({
data: data,
rowGroup: {
startRender: null,
endRender: function ( rows, group ) {
return $('<tr/>')
.append( '<td style="text-align:right;" colspan="2">Im trying to pull this to the right</td>');
},
dataSrc:'office',
},
columns: [
{ data: "position",title:'position'},
{ data: "extn" ,title:'extn'},
{ data: "first_name",title:'Name'},
{ data: "office",title:'office'},
]
});
</script>
</body>
</html>
最佳答案
您需要添加额外的 <td>
下面的标签,当你做你的返回。像这样:
table = $("#example").DataTable({
data: data,
rowGroup: {
startRender: null,
endRender: function ( rows, group ) {
return $('<tr/>')
.append( '<td style="text-align:right;" colspan="2">Im trying to pull this to the right</td>')
.append('<td></td>')
.append('<td></td>');
},
dataSrc:'office',
},
columns: [
{ data: "position",title:'position'},
{ data: "extn" ,title:'extn'},
{ data: "first_name",title:'Name'},
{ data: "office",title:'office'},
]
});
关于javascript - 如何将 rowGroup 与 DataTables 一起使用,以便 rowGroup 分隔符右对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52087395/
我想知道最终用户按下了什么,所以我使用了 getch() 。 如果用户按右,我可以获得0xE0 0x4D。 如果用户按下Ctrl+右,我可以获得0xE0 0x47。 如果用户按下Shift+右,我可以
我已经构建了一个应用程序来搜索我的位置。 这是代码 var map; var gdir; var geocoder = null; var addressMarker; function init
我想为我的元素设计布局 View 。布局 View 在左 Angular 和右 Angular (同一行)有一个图像,将有 2 行单词,一行在第 1 行,另一行在第 2 行。我该如何实现? It
我有一个很长的线性(分支不多)流程图,在 graphviz 中显示为要么太高而无法放在单个页面上,要么太宽(如果方向是从左到右) 是否有一种简单的方法可以让 graphviz 以从左到右,然后向下,然
我一直摸不着头脑,但运气不好。设计器有一个包含 3 栏的站点、两个侧边栏和一个主要内容区域。 专为桌面设计,左栏、主要内容、右栏。但是,在较小的设备上,我们希望首先堆叠主要内容。 所以通常情况下,你可
我想要从上到下和从左到右组织的 css block 。 为了更好地解释这是一张图片,其中包含我到目前为止所获得的内容以及我希望使用 CSS 实现的内容: 代码如下: HTML: 1 2 3 4 5
当我问this question时,答案之一(现已删除)建议Either类型对应Curry-Howard correspondence中的XOR而不是OR,因为它不能同时是Left和Right。 真相
如果一行中六个观察值中至少有三个是 != NA,我想计算该行的平均值。如果存在四个或更多 NA,则平均值应显示为 NA。 给出平均值的例子,忽略了 NA: require(dplyr) a % mut
我有一个由 9 列组成的数据框,其中包含一个因素 list 。每行可以填充所有 9 列(因为在该行中包含 9 个“事物”),但大多数没有(大多数有 3-4 个)。列也不是特定的,就像第 1 列和第 3
这是我第一次尝试使用 R 构建函数。基本上我的预期目标如下。 使用 RoogleVision 包与 Google Cloud Vision API 通信 函数遍历目录中的图片 从每张图片的 Googl
使用: mean (x, trim=0.05) 从分布的每一侧移除 2.5%,这对于对称的双尾数据来说很好。但是如果我有一个尾部或高度不对称的数据,我希望能够只删除分布的一侧。有没有这个功能,还是我自
我想保留重复的列,并删除唯一的列。这些列将具有相同的值,但名称不同。 x1 = rnorm(1:10) x2 = rnorm(1:10) x3 = x1 x4 = rnorm(1:10) x5 = x
是否可以使WPF工具栏中的元素的Right水平对齐方式正确? 我尝试将内部元素添加到Grid中,并将ColumnDefinition分配给Left / Right。我
datatable(head(iris)) 如何将我的列居中,使其位于我的列名称的正下方? 最佳答案 您可以使用options 下的columnDefs 自变量。将 className 设置为 dt-
我是 R 的新手,但我正在尝试在 R 中制作滑动窗口。 使用循环我可以像这样,但这变得非常低效。 results=c(1:7) letters=c("A","B","C","D","E","F","G
假设我有这个 .txt 文件: here is line 1 here is line 2 here is line 3 here is line 4 我想将此字符串粘贴到第 3 行和第 4 行之间:
假设我有这个 .txt 文件: here is line 1 here is line 2 here is line 3 here is line 4 我想将此字符串粘贴到第 3 行和第 4 行之间:
我想知道我的环境中有什么类型的对象。 我可以像这样显示谁在那里: ls() 但是运行类似的东西 sapply(ls(), class) (显然)不会告诉我们我们拥有什么类型(类)的对象(函数、数字、因
我想创建一个带有水平标签的树状图,但让叶子根据它们的高度悬挂,而不是仅仅下降到图的边缘。 例子: par(mfrow = c(1,2)) hc <- hclust(dist(USArrests), "
我的 CSS 中有一个元素,如下所示 .xyz{ position:absolute; left:50%; } 现在正如预期的那样,当我减小浏览器窗口的宽度时,这个元素向左移动
我是一名优秀的程序员,十分优秀!