PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

BEAR admin panel appearance: How to frozen/sticky position of <.dataTables_scrollHead> to the top

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

How to freeze/sticky position of <.dataTables_scrollHead> (header column of the table) to the top? For both BEAR and WOLF table.

Hello

Unfortunately the plugin does not have such a feature.

You need to customize the code and install an additional JS library

I referred to yours <. woobe-adv-panel-fixed> freezable elements. A piece of JavaScript and CSS code is written to generate the <fixed> (sticky cannot working) state to add the freezing function of the table header:

Spoiler

function handleScroll() {
const woobePanel = document.getElementById('woobe_tools_panel');
const scrollHead = document.querySelector('.dataTables_scrollHead');

if (!woobePanel || !scrollHead) return;

const woobeRect = woobePanel.getBoundingClientRect();
const scrollHeadRect = scrollHead.getBoundingClientRect();
const freezePosition = woobeRect.bottom;

if (scrollHeadRect.top <= freezePosition) {
scrollHead.classList.add('dataTables_scrollHead-fixed');
} else {
scrollHead.classList.remove('dataTables_scrollHead-fixed');
}
}

window.addEventListener('scroll', handleScroll);
window.addEventListener('resize', handleScroll);
window.addEventListener('load', handleScroll);
handleScroll();

Spoiler

.dataTables_scrollHead-fixed {
    position: fixed !important;
    top: 88px;
    z-index: 9997;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-bottom: 2px solid #e0f90a !important;
    width: calc(100% - 44px) !important; /* Minus left-right padding */
    box-sizing: border-box;
    transition: all 0.3s ease;
}

Unfortunately, because the HTML structure of Element <. Datatables_scroll head> contains inline styles code <position: relative>, so that the <position: fixed> must be added <!important> can take effect, leading this scheme to a one-way trip (only frozen and cannot be unfrozen). If both frozen and unfrozen take effect, it needs to add an additional wrapper element to achieve the unfreezing effect, for example:


 function initFreezeSystem() {
            // Create a frozen wrapper
            freezeWrapper = document.getElementById('scrollHeadFreezeWrapper');
            
            // Obtain the original header
            originalScrollHead = document.querySelector('.dataTables_scrollHead');
            
            // If the element does not exist, then exit
            if (!freezeWrapper || !originalScrollHead) return;
            
            // Clone original header
            const clonedScrollHead = originalScrollHead.cloneNode(true);
            
            // Add to Freeze Wrapper
            freezeWrapper.appendChild(clonedScrollHead);
            ……

This can be frozen and unfrozen, but it is very troublesome, and it will cause the problem that the header title and table column contents cannot be aligned...
I hope you can optimize the original code structure of the plugin so that more users can enjoy this function, which is often more needed by paying users.
Because there are more than 10 items on each page, it is very necessary to freeze the header in order to view and edit the contents of the table columns. Otherwise, it is necessary to scroll up and down continuously to confirm what the title corresponding to the content being edited is.

Hello

We will not use this code.

As I wrote above, there is a special library that does this well and is designed specifically for this table - https://datatables.net/extensions/fixedheader/

I have installed the fixedheade extensions for DataTables using the CDN method, but it seems that the version of DataTables that comes with the BEAR plugin is incompatible with the version of the extension that was added, resulting in an undefined method of this.fnSettings; The DataTables configuration that comes with the BEAR plugin has serverSide: true enabled, but the server is not responding correctly to server-side processing requests for DataTables, resulting in an infinite loading of Processing...configuration enabled serverSide: true, but the server is not responding correctly to server-side processing requests for DataTables, resulting in an infinite loading of Processing... state; and some other styling css errors.Causes the developer tools console to report the following error:

[data-tables.js?ver=2.1.4.7:273 Uncaught TypeError: this.fnSettings is not a function
at ce.fnDrawCallback (data-tables.js?ver=2.1.4.7:273:32)
at datatables.min.js:16:46811
at Array.map (<anonymous>)
at G (datatables.min.js:16:46786)
at x (datatables.min.js:16:27125)
at datatables.min.js:16:26456
at Object.t [as success] (datatables.min.js:16:32107)
at c (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.2:2:25304)
at Object.fireWith [as resolveWith] (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.2:2:26053)
at l (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-dom-ready,wp-hooks&ver=6.8.2:2:77782)]

Error display of the BEAR plugin page

What style should I choose in Step 1 - choose styling, and how should I adjust the version to match the added extensions?

Hello

In this case, write to the support of the JS library that you want to customize