Page 1 of 1

Subform Freeze Columns

Unread postPosted: Sat Aug 01, 2020 10:20 am
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?

Re: Subform

Unread postPosted: Sat Aug 01, 2020 10:24 am
by ernesttan1976
Something like this columns selector, to be able to order the fields in a customized way

Re: Subform

Unread postPosted: Sat Aug 01, 2020 3:13 pm
by kev1n
This is how you could freeze columns. Is this what you had in mind?

Re: Subform

Unread postPosted: Sat Aug 01, 2020 3:14 pm
by ernesttan1976
Yes

Re: Subform

Unread postPosted: Sat Aug 01, 2020 3:20 pm
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'
            });
        });
    });
}

Re: Subform

Unread postPosted: Sat Aug 01, 2020 3:23 pm
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.

Re: Subform

Unread postPosted: Sat Aug 01, 2020 4:07 pm
by ernesttan1976
Thank you so much Kevin! :) Much much appreciated

Re: Subform Freeze Columns

Unread postPosted: Sat Aug 01, 2020 7:07 pm
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'
            });
        });
    });
}

Re: Subform Freeze Columns

Unread postPosted: Sat Aug 01, 2020 7:10 pm
by kev1n
Nice :)