Page 1 of 2

hide(show) subform columns(objects)

Posted: Sun Mar 27, 2022 9:08 pm
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.

Re: hide(show) subform columns(objects)

Posted: Mon Mar 28, 2022 7:31 am
by kev1n
Which objects are you using and what does the subform look like?

Re: hide(show) subform columns(objects)

Posted: Mon Mar 28, 2022 8:05 am
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. :?

Re: hide(show) subform columns(objects)

Posted: Mon Mar 28, 2022 8:19 am
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'])

Re: hide(show) subform columns(objects)

Posted: Mon Mar 28, 2022 8:27 am
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) ]);
  }

Re: hide(show) subform columns(objects)

Posted: Mon Mar 28, 2022 8:53 am
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?

Re: hide(show) subform columns(objects)

Posted: Mon Mar 28, 2022 8:54 am
by kev1n
nuSubformObject() returns a JavaScript object that can be looped through.

Re: hide(show) subform columns(objects)

Posted: Mon Mar 28, 2022 9:11 am
by kev1n
Try calling nuSubformHideColumns() just ones, by passing all columns to hide. Subsequent calls might be causing that issue.

Re: hide(show) subform columns(objects)

Posted: Mon Mar 28, 2022 9:13 am
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

Re: hide(show) subform columns(objects)

Posted: Mon Mar 28, 2022 9:17 am
by kev1n
The sf values are in .rows

Code: Select all

nuSubformObject('sfobj....').rows