Welcome to the nuBuilder Forums!

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

hide(show) subform columns(objects)

Questions related to using nuBuilder Forte.
selector
Posts: 41
Joined: Tue Feb 22, 2022 1:55 pm
Has thanked: 9 times

hide(show) subform columns(objects)

Unread post by selector »

Hi. Please Tell me how to hide or display the fields in the subform (grid or shape view) by the name of the object. I've been trying to find this supposedly simple information for half a day.

I tried nuSubformHideColumns(), but this function completely breaks the appearance of the subform.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: hide(show) subform columns(objects)

Unread post by kev1n »

Which objects are you using and what does the subform look like?
selector
Posts: 41
Joined: Tue Feb 22, 2022 1:55 pm
Has thanked: 9 times

Re: hide(show) subform columns(objects)

Unread post by selector »

I need to leave the required number of columns based on the number of days in the month. The objects are of type "input nuNumber" and "select". One for each day of the month.
111.png
How to count the days and cycle through the names of objects is clear to me, but how to hide the extra columns is not.
PS: Another problem I'm facing is the automatic size of the sub form depending on the size of the browser window. :?
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: hide(show) subform columns(objects)

Unread post by kev1n »

selector wrote: Mon Mar 28, 2022 8:05 am, but how to hide the extra columns is not.

Code: Select all

nuSubformHideColumns('subformId',['subform_column1','subform_column2'])
selector
Posts: 41
Joined: Tue Feb 22, 2022 1:55 pm
Has thanked: 9 times

Re: hide(show) subform columns(objects)

Unread post by selector »

222.png
I have already tried this method. Indeed, only columns by the number of days remain, but the appearance is completely broken. The onChange event code is below.

Code: Select all

let dstr = nuGetValue("mt_date") + ".01";
let d1 = new Date(dstr);
let days = 31 - new Date(d1.getFullYear(), d1.getMonth() + 1, 0).getDate();
for (let i=1; i<= days; i++)
  {
    nuSubformHideColumns("mt_items",["tmi_" + String(32-i),"tmi_val_" + String(32-i) ]);
  }
You do not have the required permissions to view the files attached to this post.
selector
Posts: 41
Joined: Tue Feb 22, 2022 1:55 pm
Has thanked: 9 times

Re: hide(show) subform columns(objects)

Unread post by selector »

Quick question. Is it possible to get an unformatted object value. For example , an object of the nuDate type has the format "yyyy.mm ". Is it possible to get the original date value in the JS code?
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: hide(show) subform columns(objects)

Unread post by kev1n »

nuSubformObject() returns a JavaScript object that can be looped through.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: hide(show) subform columns(objects)

Unread post by kev1n »

Try calling nuSubformHideColumns() just ones, by passing all columns to hide. Subsequent calls might be causing that issue.
selector
Posts: 41
Joined: Tue Feb 22, 2022 1:55 pm
Has thanked: 9 times

Re: hide(show) subform columns(objects)

Unread post by selector »

kev1n wrote: Mon Mar 28, 2022 8:54 am nuSubformObject() returns a JavaScript object that can be looped through.
But there is no field in this object that contains the value of the object. I would like to get the original value of the object, not the subform rows.

Code: Select all

{id: 'mt_date', foreign_key: undefined, primary_key: undefined, object_id: '623094507f98840', table: undefined, …}
action: "save"
chartData: [Array(0)]
chartDataPivot: []
columns: []
deleted: []
edited: []
fields: ['ID']
foreign_key: undefined
id: "mt_date"
object_id: "623094507f98840"
primary_key: undefined
rows: []
table: undefined
[[Prototype]]: Object
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: hide(show) subform columns(objects)

Unread post by kev1n »

The sf values are in .rows

Code: Select all

nuSubformObject('sfobj....').rows
Post Reply