在Metronic Admin主题中禁用/删除sortorder [复制](Disable/Remove sortorder in Metronic Admin Theme [duplicate])

编程入门 行业动态 更新时间:2024-10-21 17:45:27
在Metronic Admin主题中禁用/删除sortorder [复制](Disable/Remove sortorder in Metronic Admin Theme [duplicate])

这个问题在这里已经有了答案:

有没有办法禁用jQuery数据表的初始排序? 4个答案 当使用jQuery DataTables 4个答案 时,禁用第一列的自动排序 如何禁用Angular Datatables中的初始数据排序? 1个答案

请帮我禁用Metronic Admin Theme的排序顺序。 或者只是禁用sortorder,直到用户点击sortorder图标。

我遵循这一点 ,但不知何故,它不与我一起工作。

我已经将columnDefs中的代码(从assets / pages / scripts / table-datatables-managed.min.js )更改为:

columnDefs: [{ orderable: false, targets: [0] },

但它不起作用。 刷新页面时,图标排序始终激活。 但是当我从这个文件中更改语言时,它正在运行。 我已经在/assets/global/scripts/datatable.js中执行过相同的操作,但这不起作用。

请帮忙。

This question already has an answer here:

Is there a way to disable initial sorting for jquery DataTables? 4 answers Disable automatic sorting on the first column when using jQuery DataTables 4 answers How to disable initial Ordering of data in Angular Datatables? 2 answers

Please help me to disable the sortorder of Metronic Admin Theme. Or just maybe disable sortorder until user click on the sortorder icon.

I follow this, but somehow, it's not working with me too.

I already change the code from columnDefs (from assets/pages/scripts/table-datatables-managed.min.js) into:

columnDefs: [{ orderable: false, targets: [0] },

But it's not working. The icon sort always activate when I refresh page. But when I change language from this file, it's working. I already do the same in /assets/global/scripts/datatable.js but it's not work too.

Please help.

最满意答案

这是一个有效的例子: 但是当我从这个文件中更改语言时,它正在运行。

提供一个链接到你不工作的代码

编辑:要完全禁用排序,请在初始设置中使用此选项

"ordering": false,

虽然要禁用特定列,请在初始设置中使用此列

"columns": [ { "orderable": true }, { "orderable": true }, { "orderable": false }, { "orderable": false }, { "orderable": false }, { "orderable": true } ]

这个例子可以帮助你更好地理解排序

https://jsfiddle.net/g1y8eu8v/1/

以下是一些参考链接:

https://datatables.net/reference/option/columns.orderable

https://datatables.net/reference/option/ordering

https://datatables.net/reference/option/columns.orderSequence

So a working example: But when I change language from this file, it's working.

Provide a link to your not working code

Edit: To disable sorting completely, use this in your init setting

"ordering": false,

While to disable for specific column(s), use this in your init setting

"columns": [ { "orderable": true }, { "orderable": true }, { "orderable": false }, { "orderable": false }, { "orderable": false }, { "orderable": true } ]

This example might help you understand sorting better

https://jsfiddle.net/g1y8eu8v/1/

Here are some reference links:

https://datatables.net/reference/option/columns.orderable

https://datatables.net/reference/option/ordering

https://datatables.net/reference/option/columns.orderSequence

更多推荐

本文发布于:2023-04-29 11:10:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336322.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:主题   sortorder   Metronic   Admin   Theme

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!