Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Hide column if form = iframe
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Hide column if form = iframe
How to hide a column if the form is currently an iframe on another browse form
-
- nuBuilder Team
- Posts: 4428
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 74 times
- Been thanked: 475 times
- Contact:
Re: Hide column if form = iframe
What do you mean by "iframe on another browse form"? Is the browse embedded as iframe in another form (run object with method iFrame) ?
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: Hide column if form = iframe
I have a form (1) with a column = date where the data is entered. The date is taken from another form (2). To the form (2) in edit mode I connect iframe = form (1) where as filter the #form (2)_ date#. Since I already have the date on the main form (2), then in the iframe I do not need it to display it.
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4428
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 74 times
- Been thanked: 475 times
- Contact:
Re: Hide column if form = iframe
That's how it works for me: Add the JavaScript to the Custom Code of your Browse Form:
Code: Select all
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 iniFrame() {
return window.location !== window.parent.location;
}
if (iniFrame()) {
$(function () {
hideBrowseColumn(0); // Hide the first column
});
}
You do not have the required permissions to view the files attached to this post.
Last edited by kev1n on Tue May 05, 2020 12:26 am, edited 1 time in total.
Re: Hide column if form = iframe
kknm,
You can Clone the Form, hide the column, and redirect the new Form to the Original Edit Form.
https://wiki.nubuilder.cloud/ ... edirect_To
Steven
You can Clone the Form, hide the column, and redirect the new Form to the Original Edit Form.
https://wiki.nubuilder.cloud/ ... edirect_To
Steven
-
- nuBuilder Team
- Posts: 4428
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 74 times
- Been thanked: 475 times
- Contact:
Re: Hide column if form = iframe
In kknm's case, cloning is probably not optimal since JS is used in the browse form (redundancy -> maintenance effort)
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: Hide column if form = iframe
I have such iframes on the main form (2) of 7 pieces.
While writing your answer, you changed the function, I was even scared. The changed function works correctly, but I would like it to be possible to do this for all iframes on the main form (2).
While writing your answer, you changed the function, I was even scared. The changed function works correctly, but I would like it to be possible to do this for all iframes on the main form (2).
-
- nuBuilder Team
- Posts: 4428
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 74 times
- Been thanked: 475 times
- Contact:
Re: Hide column if form = iframe
I just simplified it a little.kknm wrote:I have such iframes on the main form (2) of 7 pieces.
While writing your answer, you changed the function, I was even scared.
You can add the code to each form or add these two functions to the (Setup -> ) Header. (Log in again to nuBuilder afterwards)but I would like it to be possible to do this for all iframes on the main form (2).
Code: Select all
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 iniFrame() {
return window.location !== window.parent.location;
// or:
// return parent !== window;
}
Code: Select all
if (iniFrame()) {
$(function () {
hideBrowseColumn(0); // Hide the first column
});
}
Last edited by kev1n on Tue May 05, 2020 7:03 am, edited 1 time in total.
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: Hide column if form = iframe
Yes, everything works wonderfully. Finally, I will get rid of a bunch of clones.
I am confused by the warnings in Settings - Title.
I am confused by the warnings in Settings - Title.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: Hide column if form = iframe
There was an unpleasant moment for viewing the iframe - the bottom scroll appeared.
And I would also like to remove the search field and buttons in this row in iframe mode.
And I would also like to remove the search field and buttons in this row in iframe mode.