数据表响应优先级 [英] DataTables Responsive Priority
问题描述
代码:
$ b $我使用这个惊人的插件,但是在列上使用响应优先级时发现问题。 b
var fillTable = function(data){
var list = [
{name:'Name 123456789',email:email @ email@email.com},
{name:'Name 123456789_11',email:email@email.com,
{name:'Name 123456789_10' }
{name:'Name 123456789_12',email:email@email.com},
{name:'Name 123456789_13',email:email@email.com}
];
var tableToFill = $('#js-table')。DataTable({
respond:true,
columnDefs:[
{respondPriority:1,targets: 1}
],
列:[
{data:name,title:Name},
{data:email,title:Email}
],
语言:localiseDataTable(),
order:[[0,'desc']]
});
tableToFill.clear();
tableToFill.rows.add(list);
tableToFill.draw(false);
tableToFill.columns.adjust()。respond.recalc();
}
有人可以解释为什么当我缩小屏幕时,我使用Plus标志不再出现: {respondPriority:1,targets:1} 。这使得不可能看到 childRow ,并因此在低分辨率屏幕中看到第一列数据。
提前感谢
这与框架中的限制有关。
+图标并且按钮效果被应用到第一列,而不管它是否可见。
{respondPriority:1,targets:1}
当列计数从0开始时,将第二列设置为最高视觉优先级。
如果您希望它保持第二列和优先级,我建议您创建第一列空白列。
I am using this amazing plugin but I have found a problem when using responsive priority on columns.
Code:
var fillTable= function (data) {
var list = [
{ name: 'Name 123456789', email: "email@email.com"},
{ name: 'Name 123456789_10', email: "email@email.com"},
{ name: 'Name 123456789_11', email: "email@email.com"},
{ name: 'Name 123456789_12', email: "email@email.com"},
{ name: 'Name 123456789_13', email: "email@email.com"}
];
var tableToFill= $('#js-table').DataTable({
responsive: true,
columnDefs: [
{ responsivePriority: 1, targets: 1 }
],
columns: [
{ data: "name", title: "Name" },
{ data: "email", title: "Email" }
],
language: localiseDataTable(),
order: [[0, 'desc']]
});
tableToFill.clear();
tableToFill.rows.add(list);
tableToFill.draw(false);
tableToFill.columns.adjust().responsive.recalc();
}
Can someone explain me why when I shrink the screen the "Plus" sign does not appear anymore when I use : { responsivePriority: 1, targets: 1 }. This makes impossible to see the childRow and by consequence to see the first column data in low resolution screens.
Thanks in advance
This has to do with a limitation in the framework.
The + icon and button effect is applied to the first column regardless of if it is visible or not.
{ responsivePriority: 1, targets: 1 }
As the column count starts at 0 this sets the second column to the highest visual priority.
If you want it to remain both the second column and the priority i suggest you create a third empty column that is the first column.
这篇关于数据表响应优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!