Hi i have question. When i want to save what i change in repeater my funcion seems to save and refresh only inside repeater. How can i change it to save whats in repeater but refresh whole dataset because its sorted. I want to refresh sorting after save.
export function button71_click(event, $w) { return $w(“#dataset1”).save()
.then(() => {
// Data is saved now refresh the dataset1
$w(“#dataset1”).refresh();
})
. catch ( (err) => { let errorMsg = err;
console.log(errorMsg);
});
}
If I understand you correctly, on your page site you had a repeater that connected to a dataset.
You set a sort() on your dataset (I believe you have set it in the dataset’s setting), and moreover your dataset supposed to be in read & write mode because you wish to present data and update
You had an onClick() event handler on button71 and at the handler you save the changes and refresh the dataset in order to sort again the data in the repeater.
If this is the case your function supposed to work, otherwise please be more specified while describing the issue.
In addition, please send us a URL to your site and specified the page name so we can inspect.
Is page to write itinerary of wedding. People write start time and what is happening and save. Dataset is sorted by hour of start (first input) when i save and go again to site its sorted so it works. It seems like button refresh before save. Is it possible?
Cancel the sort that you have done with the editor and instead create your own sort function at the page site. In the the function use setSort( ) on the dataset.
function sort(){
// write the setSort() function
}
Here you can watch how to do it with code.
In order to first sort the dataset, at the onReady() function, add an onReady() event handler to the dataset and summon the sort() function in the handler.
Add an export function to your dataset - onAfterSave() and summon the sort() function.
This function will be triggered each time you save an item in your dataset, as a result your sort function will also be activated.
Here you can read more about this function.
ok. I was thinking of go to some page “reload” and than back. But its strange because i’m almost sure few weeks ago it worked and it stopped working suddenly. I will try Your solution.
Thank You so much for Your time. Chris
Sorry its me again because something really strange is happening. My funcion sortuj() i checked works but afterSave doesnt. You can see it in “Lista Gosci” page.
It also shows me error. But it doesnt matter becasue its only to sort at the beginning. When i // this funcion and start page after save behave like doesnt exist. Whats more there is no mistakes.
@sapirh When I use this the repeater does refresh, but only back to last input from “button 71”…so if user has just input an item, that item is not included in the refresh
what does #input5 represent? Also I assume it is input form field but after pressing submit the page where the repeater is is doing nothing no repeater refresh