Page 1 of 2

NuShow() - strange behavior

Posted: Thu Apr 08, 2021 1:57 pm
by kknm
In one main form procedure I call two nuShow ('sub_jurw_if') and nuShow ('but_ok')
Only the subform appears. If you comment out either of the two, it works separately.

Code: Select all

    var dep = $('#obz_dep');    
    var comp = $('#obz_com');
    var dat = new Date().toLocaleDateString();
    $("#sub_jurw_if000dep").val(dep.val());
    $("#sub_jurw_if000computer").val(comp.val());    
    $("#sub_jurw_if000jur_wdata").val(dat); 
    nuShow('sub_jurw_if');
    nuShow('but_ok');   
Initially the subform and button are hidden.

Re: NuShow() - strange behavior

Posted: Thu Apr 08, 2021 3:57 pm
by kknm
Added a few more different hidden objects and as many nuShow() to LaunchForm.
Only one object becomes visible anyway. This is not the case in nuBuilder4.

Re: NuShow() - strange behavior

Posted: Thu Apr 08, 2021 4:13 pm
by kev1n
I justed tested it with an old nuBuilder 4 installation by setting the Access of an object to hidden and calling

Code: Select all

nuShow('hidden_object')


Result: The object didn't show up.

Re: NuShow() - strange behavior

Posted: Thu Apr 08, 2021 4:38 pm
by kev1n
I'll have to investigate. For the time being, you can try forceShow() instead of show()

Code: Select all

function forceShow(i, tab) {
	$('#'+ i).attr('data-nu-tab', 'x'+tab);
	$('#label_'+i).attr('data-nu-tab', 'x'+tab);
	nuShow(i);
}

Code: Select all

forceShow('sub_jurw_if', '0'); // 0 means the object is on the first tab, 1 = 2nd tab etc.
forceShow('but_ok', '0');

Re: NuShow() - strange behavior

Posted: Fri Apr 09, 2021 8:33 am
by kknm
ForceShow () did not work for me in one function. Added another function with normal nuShow (). The errors in the debugger are the same, but both objects become visible.

Code: Select all

nucommon.js?ts=20210409081413:2052 Argument #2 is not an array in nuAddDatalist()

nucommon.js?ts=20210409081413:983 Uncaught TypeError: Cannot read property 'id' of undefined
    at nuShow (nucommon.js?ts=20210409081413:983)
    at add_jurw (<anonymous>:21:5)
    at HTMLButtonElement.onclick ((index):1)
nuShow @ nucommon.js?ts=20210409081413:983
add_jurw @ VM2136:21
onclick @ (index):1
nucommon.js?ts=20210409081413:983 Uncaught TypeError: Cannot read property 'id' of undefined
    at nuShow (nucommon.js?ts=20210409081413:983)
    at HTMLDivElement.onchange ((index):1)

Re: NuShow() - strange behavior

Posted: Fri Apr 09, 2021 8:48 am
by kev1n
If you just call

Code: Select all

forceShow('sub_jurw_if', '0');
and nothing else, does that error also appear?

Re: NuShow() - strange behavior

Posted: Fri Apr 09, 2021 9:15 am
by kknm
kev1n wrote:If you just call

Code: Select all

forceShow('sub_jurw_if', '0');
and nothing else, does that error also appear?
Yes...

Code: Select all

nucommon.js?ts=20210409100338:2052 Argument #2 is not an array in nuAddDatalist()
nuAddDatalist @ nucommon.js?ts=20210409100338:2052
nuINPUT @ nuform.js?ts=20210409100338:745
nuBuildEditObjects @ nuform.js?ts=20210409100338:546
nuBuildForm @ nuform.js?ts=20210409100338:164
successCallback @ nuajax.js?ts=20210409100338:117
success @ nuajax.js?ts=20210409100338:17
c @ jquery.js?ts=20210409100338:2
fireWith @ jquery.js?ts=20210409100338:2
l @ jquery.js?ts=20210409100338:2
(anonymous) @ jquery.js?ts=20210409100338:2
load (async)
send @ jquery.js?ts=20210409100338:2
ajax @ jquery.js?ts=20210409100338:2
nuAjax @ nuajax.js?ts=20210409100338:8
nuForm @ nuajax.js?ts=20210409100338:122
nuGetBreadcrumb @ nucommon.js?ts=20210409100338:123
onclick @ (index):1
nucommon.js?ts=20210409100338:983 Uncaught TypeError: Cannot read property 'id' of undefined
    at nuShow (nucommon.js?ts=20210409100338:983)
    at forceShow (<anonymous>:46:4)
    at add_jurw (<anonymous>:22:5)
    at HTMLButtonElement.onclick ((index):1)

Re: NuShow() - strange behavior

Posted: Fri Apr 09, 2021 9:22 am
by kknm
Calling the function

Code: Select all

JSON.stringify(nuSubformObject(''));
not observing the buttons and subform objects.

Code: Select all

"{"id":"nuBuilder4EditForm","foreign_key":"","primary_key":"obz_id","object_id":"605899466482e56","table":"obzor","action":"save","rows":[["-1",0,"","","","","","[]"]],"columns":[[],[],[],[],[],[],[]],"chartData":[[null,null,null,null,null,null],[0,0,0,0,0,0]],"chartDataPivot":[[null,0],[null,0],[null,0],[null,0],[null,0],[null,0]],"edited":[[0,0,0,0,0,0,0,0]],"deleted":[0],"fields":["ID","nuDelete","obz_dep","obz_com","obz_pr","obz_kart","obz_d","sel"]}"

Re: NuShow() - strange behavior

Posted: Fri Apr 09, 2021 9:32 am
by kev1n
Is there anything (invalid or spaces) in the Datalist field?

Re: NuShow() - strange behavior

Posted: Fri Apr 09, 2021 9:52 am
by kknm
Yes !
One of the fields had a space in the datalist.The first mistake is gone.