Page 1 of 3

Show several functional directories on the form

Posted: Tue Mar 23, 2021 8:06 am
by kknm
How to show several functional directories on one form?
For instance:
1 Departments
2 Computers
3 Equipment
All directories are linked.
Choosing an item in 1 -> 2 directory is filtered.
Choosing item in 2 -> 3 directory is filtered.

Re: Show several functional directories on the form

Posted: Tue Mar 23, 2021 8:40 am
by kev1n
Use Hash Cookies in the Computers and Equipment select object. Then call nuRefreshSelectObject() in the onchange event of Departments and Computers to refresh the other select objects.

Re: Show several functional directories on the form

Posted: Tue Mar 23, 2021 9:12 am
by kknm
kev1n wrote:Use Hash Cookies in the Computers and Equipment select object. Then call nuRefreshSelectObject() in the onchange event of Departments and Computers to refresh the other select objects.
First, I want to figure out how to show a copy of the main directory (Departments) on an empty form. If as a subform, then a foreign key is required, but it is not needed here.

Re: Show several functional directories on the form

Posted: Wed Mar 24, 2021 7:04 am
by kknm
kev1n wrote:Use Hash Cookies in the Computers and Equipment select object. Then call nuRefreshSelectObject() in the onchange event of Departments and Computers to refresh the other select objects.
Probably I am misrepresenting my idea. I'll try again ...
I want the form to reflect the complete directory (in the form of a list) Departments and subordinate forms Computers and Equipment. Moreover, if I go to an item with a department, it should not open anything, as browseForm does. I have to get the name of the Department item and submit it to the subform for filtering. I'm primarily interested in - how to create a list of departments - leaning towards the HTML variant, but maybe there is a better way?

Re: Show several functional directories on the form

Posted: Wed Mar 24, 2021 7:53 am
by kev1n
kknm wrote:Moreover, if I go to an item with a department, it should not open anything, as browseForm does.
You can easily prevent this by adding this JS to your Browse Form.

Code: Select all

function nuSelectBrowse() {
   return false;
}
I don't exactly understand what you are trying to do. Can you visualise what you are trying to achieve (using paint, excel etc.) ?

Re: Show several functional directories on the form

Posted: Wed Mar 24, 2021 8:57 am
by kknm
I am migrating several Access databases to nuBuilder and want to achieve similar functionality.
10_45_53.png

Re: Show several functional directories on the form

Posted: Wed Mar 24, 2021 9:09 am
by kev1n
For 1) you could use a select Object. Set multiple to true. Then call selectSingle() in the form's Custom Code so that just one item can be selected but to retain the list style.

Code: Select all

function selectSingle(f) {
   $('#' + f).removeAttr('multiple');
   $('#' + f).attr('size', '5');
}
For 2 + 3) Use Browse Forms (iFrame, Run) and use Hash Cookies (e.g. name A_HASH_COOKIE or a meaningful name) in your SQL to filter based on the selection.

In the select object, add an onchange event with a JS like the following to refresh a Browse form.

Code: Select all

document.getElementById("browseIframeId").contentWindow.nuSetProperty('A_HASH_COOKIE',$('#select_obj_id').val());
$("#browseIframeId")[0].contentWindow.nuGetBreadcrumb(0);

Re: Show several functional directories on the form

Posted: Wed Mar 24, 2021 11:58 am
by kknm
I already guessed that 'Departments' should be like Select, I played with it for a long time and with nuRefreshSelectObject () from your previous answers, but I could not achieve anything.
Now new introductions that I can't figure out ...

Code: Select all

document.getElementById("browseIframeId").contentWindow.nuSetProperty('A_HASH_COOKIE',$('#select_obj_id').val());
$("#browseIframeId")[0].contentWindow.nuGetBreadcrumb(0);
I have:
1 Select:
Tag: Departments
Id: fltr
2 RUN:
Tag: Computers
Id: sub_kom
Type: iFrame
Filter:fltr
Record_id: empty
NuHash returns the 7 value of the selected field in 'select' as [fltr] => [\"'7\"']
I did this in onchange:

Code: Select all

document.getElementById ('sub_kom'). contentWindow.nuSetProperty ('fltr', $ ('# fltr'). val ());
$ ('# sub_kom') [0] .contentWindow.nuGetBreadcrumb (0);
But nothing happens

How should i change your code for onchange ()?

Re: Show several functional directories on the form

Posted: Wed Mar 24, 2021 12:21 pm
by kev1n

Code: Select all

$ ('# sub_kom') [0] .contentWindow.nuGetBreadcrumb (0);
There's no space after the #.

Code: Select all

$('#sub_kom')[0].contentWindow.nuGetBreadcrumb(0);

Re: Show several functional directories on the form

Posted: Wed Mar 24, 2021 12:31 pm
by kknm
Of course, there are no spaces in the function - it's either the translator or the browser substitutes it.

Code: Select all

document.getElementById("sub_kom").contentWindow.nuSetProperty('fltr',$('#fltr').val());
$("#sub_kom")[0].contentWindow.nuGetBreadcrumb(0);