Welcome to the nuBuilder Forums!

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

Subform Freeze Columns

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Subform Freeze Columns

Unread post by ernesttan1976 »

Hi to all, I really appreciate the developers of this software.

I created a subform called employees.
In this subform I am able to edit the fields which is really cool.

I want to be able to freeze the left 2 columns while I scroll to the fields to the right.

May I know how to go about this?
You do not have the required permissions to view the files attached to this post.
Last edited by ernesttan1976 on Sat Aug 01, 2020 8:42 am, edited 2 times in total.
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Re: Subform

Unread post by ernesttan1976 »

Something like this columns selector, to be able to order the fields in a customized way
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Subform

Unread post by kev1n »

This is how you could freeze columns. Is this what you had in mind?
You do not have the required permissions to view the files attached to this post.
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Re: Subform

Unread post by ernesttan1976 »

Yes
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Subform

Unread post by kev1n »

Add the following code to your (main) form's Custom Code.

Code: Select all

// Save the left position of your 2nd column. Replace **accform000slf_zzzzsys_form_idbutton** with your object ID. (Use the developer console to figure it out)
var originalBtnLeft = $('#accform000slf_zzzzsys_form_idbutton')[0].offsetLeft;

 if (nuFormType() == 'edit') {
    $('#accform').scroll(function (e) {
      
        var scrollLeft = $(this).scrollLeft();
      
      // Replace slf_zzzzsys_form_idcode with the object ID of your first column
        $("[id$='slf_zzzzsys_form_idcode']").each(function () {
            $(this).css({
                'left': 0 + scrollLeft,
                'z-index': '100'
            });
        });

        // Replace slf_zzzzsys_form_idbutton with the object ID of your first column
        $("[id$='slf_zzzzsys_form_idbutton']").each(function () {
            $(this).css({
                'left': originalBtnLeft + scrollLeft,
                'z-index': '100'
            });
        });
    });
}
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Subform

Unread post by kev1n »

For your 2nd question: May I ask you to open a new topic for that? It will be easier for others to find answers in the future.
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Re: Subform

Unread post by ernesttan1976 »

Thank you so much Kevin! :) Much much appreciated
ernesttan1976
Posts: 51
Joined: Sat May 16, 2020 10:08 am

Re: Subform Freeze Columns

Unread post by ernesttan1976 »

Success! Thank you Kevin :D

Code: Select all

// Save the left position of your 2nd column. Replace //**accform000slf_zzzzsys_form_idbutton** with your object ID. (Use the //developer console to figure it out)




var originalBtnLeft = $('#assigned_personnel000emp_name')[0].offsetLeft;

if (nuFormType() == 'edit') {
    $('#assigned_personnel').scroll(function (e) {
     //assigned_personnel
        var scrollLeft = $(this).scrollLeft();
     
      // Replace slf_zzzzsys_form_idcode with the object ID of your first column

        //All first column ends with "user_field_01"
        $("[id$='user_field_01']").each(function () {
            $(this).css({
                'left': 0 + scrollLeft,
                'z-index': '100'
            });
        });
        

        //First column header
        $("title_assigned_personneluser_field_01").each(function () {
            $(this).css({
                'left': 6 + scrollLeft,
                'z-index': '100'
            });
        });

        //All second column ends with emp_name
        $("[id$='emp_name']").each(function () {
            $(this).css({
                'left': originalBtnLeft + scrollLeft,
                'z-index': '100'
            });
        });
    });
}
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Subform Freeze Columns

Unread post by kev1n »

Nice :)
Post Reply