Page 2 of 2
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Mon Nov 16, 2020 7:43 pm
by Janusz
Hi,
What I saw on picture, but it's quite limited info and maybe I am not right - I would think about some structure change.
In the PSP Plannung Massnahmenliste you have
Proj ID and Projectnummer - are they equivalent?
If yes I would NOT use Proj ID in Browse or Edit form at all - use just only Projectnummer - and link all Forms with Projectnummer (e.g. 6-10-000174) - then form linking will be very easy.
Do you use auto increment for the Proj ID?
How can I use the value of the r.attr('data-nu-primary-key') in the select statement of the form "5faebeae9db455f"
you can use directly as you placed in the code, but your Proj ID is something like 1,2,3, - and in such case filter with just 1 will not be good - and probably 99% of records will be selected.
If you would have Proj ID as varchar() with id like 5faebeae9db455f then it would be easy.
But if possible I would just stick to Projectnummer.
Maybe you can try completely other solutions with hash cookies for example - but I have limited experience how it behaves between different forms.
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Mon Nov 16, 2020 10:13 pm
by paulkauz
Code: Select all
SELECT
tamassnahmenpsp.*
FROM
tamassnahmenpsp
WHERE tamassnahmenpsp.PSP_MassnID = ???
What i have in mind is to bring the value of r.attr('data-nu-primary-key') to the sql statement
If for example the MassnID = 6, then it should bring all the records in the Table tamassnahmenpsp wit the PSP_MassnID = 6
Its a normal one to many relation.
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Mon Nov 16, 2020 10:51 pm
by Janusz
for that you could try to use hash cookies
https://wiki.nubuilder.cloud/ ... sh_Cookies
and
https://wiki.nubuilder.cloud/ ... etProperty
but the issue I had during quick try was that the hash cookie defined in one form was not visible in the other - but it was just a quick try so maybe there is some possibility anyway.
between different forms on js level you can exchange data with session storage:
Code: Select all
sessionStorage.setItem('Proj_ID',r.attr('data-nu-primary-key')); // save data on first form
var Proj_ID = sessionStorage.getItem('Proj_ID'); // get data on second form
sessionStorage.removeItem('Proj_ID'); // remove data
on second form you can try set set hash cookies with
and in Browse SQL use:
Code: Select all
....
WHERE PSP_MassnID='#Proj_ID#' or something like that
...
just idea not tested at all
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Tue Nov 17, 2020 10:57 pm
by paulkauz
Code: Select all
sessionStorage.setItem('Proj_ID',26); // save data on first form
var Proj_ID = sessionStorage.getItem('Proj_ID'); // get data on second form
function nuSelectBrowse(e){
var r = $('#' + e.target.id);
nuForm("5faebeae9db455f", '', '', '' , '0');
}
Problem 1
With this code I can see on the form 5faebeae9db455f the Proj_ID = 26
If I put in the r.attr('data-nu-Primary-key') into the code I get an error
Problem 2
I see on the console Proj_ID = "26" but the select statement
Code: Select all
SELECT
tamassnahmenpsp.*
FROM
tamassnahmenpsp
WHERE tamassnahmenpsp.MassnID = #Proj_ID#
does not work. Is this because it transfers a string and the mysql db expects an int ? or do I have a misspelling somewhere in the statement.
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Wed Nov 18, 2020 8:31 am
by Janusz
hash cookies has to be between apostrophe
I would tranfers all data as txt so: sessionStorage.setItem('Proj_ID','26'); - not sure if manadatory but probably would do like that.
And one more point - after new form is open and is empty - try to refresh (CTRL+SHIFT+R) - I noticed someting like one step delay once making some quick trial.
you can try to analyse as well event flow if it is suppoused to work properly:
https://wiki.nubuilder.cloud/ ... ntFlow.PNG
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Wed Nov 18, 2020 10:12 am
by kev1n
You can also join Discord to discuss (I also speak German). It's way easier...
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Wed Nov 18, 2020 4:15 pm
by paulkauz
The solution!
First Form
CUSTOM CODE
function nuSelectBrowse(e) {
var pk = $(e.target).attr('data-nu-primary-key');
nuSetProperty('pk',pk)
nuForm('5faebeae9db455f', '','' , '', '1');
return false;
}
Second Form
BROWSE
SELECT
tamassnahmenpsp.*
FROM
tamassnahmenpsp
WHERE tamassnahmenpsp.MassnID=#pk#
Thanks to all, helping me to find this solution
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Wed Nov 18, 2020 7:35 pm
by Janusz
So great if it's OK
I was a little bit curious - as before I was testing this - and it was not working - so did some more test.
Code: Select all
so this solution works OK with:
nuForm('5c23e11c067a524', '','' , '', '1');
but it does not work with:
nuForm('5c23e11c067a524', '','' , '', '0');
or
nuForm('5c23e11c067a524', '','' , '', '2');
do you have similar behavior on your application?
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Wed Nov 18, 2020 8:29 pm
by paulkauz
Yes it works for me as well only with the '1'
Re: Jump from a browse form to a filtered browse and edit fo
Posted: Wed Nov 18, 2020 8:42 pm
by paulkauz
an other solution:
First Form
CUSTOM CODE
function nuSelectBrowse(e) {
var pk = $(e.target).attr('data-nu-primary-key');
nuSetProperty('pk',pk)
window.nuFORM.setProperty('page_number', 0);
nuForm('5faebeae9db455f', '','' , '', '1');
return false;
}
Second Form
BROWSE
SELECT
tamassnahmenpsp.*
FROM
tamassnahmenpsp
WHERE tamassnahmenpsp.MassnID=#pk#