Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Beautiful table.

Questions related to customising nuBuilder Forte with JavaScript or PHP.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Beautiful table.

Unread post by kknm »

Code: Select all

 <script src="core/libs/apexcharts/apexcharts.min.js";
// Сделать редактируемым Калькулятор (Object -> Calc Tab) not readonly
function enableFormulaField() {

    if (window.global_access) {
        if ((nuCurrentProperties().form_id == 'nuobject')) {
            $("#sob_calc_formula")
            .prop("readonly", false)
            .removeClass('nuReadonly');
        }
    }
}

function browseGroupColumns(firstColumnIndex, lastColumnIndex, caption) {

    // Initialize totalWidth to 0
    let totalWidth = 20;

    // Loop through the specified range of columns and sum their widths
    for (let i = firstColumnIndex; i <= lastColumnIndex; i++) {
        totalWidth += $('#nuBrowseTitle' + i).width();
    }

    // Create a new div element for the group header
    let newDiv = $('<div></div>')
        .html(caption) // Set the header text
        .css({
            'width': totalWidth + 'px', // Use the calculated total width
            'position': 'absolute'
            , 'text-align': 'center'
            , 'font-size': '13px'
            , 'color': '#0073aa'
            , 'font-weight': '600'
            , 'border-style': 'solid'
            , 'border-width': 'thin'
        });

    // Find the position of the first column
    const position = $('#nuBrowseTitle' + firstColumnIndex).position();

    // Find the original position of the first column
    const orgTop = $('#nuBrowseTitle0').attr('org-top') ?? position.top;

    // Calculate the new top
    const newtop = (orgTop ? parseFloat(orgTop, 10) : position.top + 8);

    // Adjust the new div's position
    newDiv.css({
        'top': newtop + 'px', // Adjust this value as needed
        'left': position.left
    });

    // Insert the new div into the DOM before the first column title
    $('#nuBrowseTitle' + firstColumnIndex).before(newDiv);

    // Adjust the positions of titles to make room for the group header by moving them down
    $('.nuBrowseTitle').each(function() {

        if ($(this).attr('org-top') === undefined) {
            const currentTop = parseInt($(this).css('top'), 10);
            $(this).css('top', (currentTop + 24) + 'px') // Adjust this value as needed
                .attr('org-top', orgTop);
        }
    });
}

function nuOnLoad() {
    enableFormulaField();
}

function hideBrowseColumn(column) {
    var cw = parent.$("#" + window.frameElement.id)[0].contentWindow;
    cw.nuFORM.breadcrumbs[cw.nuFORM.breadcrumbs.length - 1].column_widths[column] = 0;
    cw.nuSetBrowserColumns(cw.nuFORM.breadcrumbs[cw.nuFORM.breadcrumbs.length - 1].column_widths);
}


function increaseBrowseTitleHeight() {
    // Increase holder height
    $('#nuActionHolder').css({
        'height': '40px'
    });
    // Increase title height
    var t = -20;
    $('.nuBrowseTitle').not('#nuBrowseFooter').css('top', t);
}

function increaseFrameTitleHeight() {
    $('#nuBreadcrumbHolder').css({
        'height': '40px'
    });
    // Increase title height
    var t = -20;
    $('.nuBrowseTitle').not('#nuBrowseFooter').css('top', t);
}

jQuery.fn.cssNumber = function(prop) {
    var v = parseInt(this.css(prop), 10);
    return isNaN(v) ? 0: v;
};
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Beautiful table.

Unread post by kev1n »

The error is still there. See my previous correction.

Add this at the end:

Code: Select all

</script>

<script src='core/libs/apexcharts/apexcharts.min.js'></script>

<script>
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Beautiful table.

Unread post by kknm »

Everything works correctly!!!
What are the basic rules when working with Setup - Header? It's still a mystery to me...
Kevin when do you sleep and relax?
I am impressed !
Post Reply