Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
save form without full redraw
save form without full redraw
I apologize for such a simple question. nuSaveAction() leads to the interruption of the procedure from which it is called and the redrawing of the entire form. Is there a regular way to save data with the receipt of data-nu-primary-key without stopping the procedure. As an example, before adding rows to the table, you need to know the primary key of the parent form.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: save form without full redraw
I'm afraid I don't quite understand the question. Could you give more details together with a concrete example?
Re: save form without full redraw
Code: Select all
function selectSotr(){
if (nuIsNewRecord()) {
nuSaveAction();
}
let arrRows = nuSubformObject('sf_yavka').rows;
let arrChecked = [];
for (let index = 0; index < arrRows.length; ++index) {
arrChecked.push(arrRows[index][1]);
}
localStorage.setItem("arrChecked", JSON.stringify(arrChecked));
nuPopup('627e8e6691182e4', '', '');
}
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: save form without full redraw
Would something like this work?
Code: Select all
var openPopup = false;
function selectSotr() {
if (nuIsNewRecord()) {
openPopup = true;
nuSaveAction();
} else {
openPopup = false;
}
}
function nuAfterSave() {
if (openPopup === true) {
let arrRows = nuSubformObject('sf_yavka').rows;
let arrChecked = [];
for (let index = 0; index < arrRows.length; ++index) {
arrChecked.push(arrRows[index][1]);
}
localStorage.setItem("arrChecked", JSON.stringify(arrChecked));
nuPopup('627e8e6691182e4', '', '');
}
}
Re: save form without full redraw
Yes. It was easy ) Popup should open anyway. Regardless of whether there is a new entry or not. But in this case, I can simply add a function call to the else block. Thanks
Re: save form without full redraw
Code: Select all
function fillSotrPopup(){
let arrRows = nuSubformObject('sf_yavka').rows;
let arrChecked = [];
for (let index = 0; index < arrRows.length; ++index) {
arrChecked.push(arrRows[index][1]);
}
localStorage.setItem("arrChecked", JSON.stringify(arrChecked));
nuPopup('627e8e6691182e4', '', '');
}
function nuAfterSave(){
if (openPopup === true) {
fillSotrPopup();
}
}
function selectSotr(){
if (nuIsNewRecord()) {
openPopup = true;
nuSaveAction();
} else {
openPopup = false;
fillSotrPopup();
}
}
in nuAfterSave openPopup variable = false in debugger )
Maybe I should use nuSetProperty?
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: save form without full redraw
Yes already did it ) Thank you.
PS: But I used nuSetProperty as a storage. You cannot omit the variable declaration. Or I did something wrong.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: save form without full redraw
Code: Select all
function fillSotrPopup(){
let arrRows = nuSubformObject('sf_yavka').rows;
let arrChecked = [];
for (let index = 0; index < arrRows.length; ++index) {
arrChecked.push(arrRows[index][1]);
}
localStorage.setItem("arrChecked", JSON.stringify(arrChecked));
nuPopup('627e8e6691182e4', '', '');
}
function selectSotr(){
if (nuIsNewRecord()) {
nuSetProperty("openPopup", "1", true);
nuSaveAction();
} else {
nuSetProperty("openPopup", "0", true);
fillSotrPopup();
}
}
function nuAfterSave(){
if (nuGetProperty("openPopup") === "1") {
nuSetProperty("openPopup", "0", true);
fillSotrPopup();
}
}