Hello,
I have created a kendo window on click of a button that opens the edit page of a particular record and when the user clicks on save in the kendo window edit page, I would like to reload the current page where the button is placed. Is there a way I could detect the event after the edit page record is saved and then perform a page reload of the parent page? Kindly let me know.
Cheers.
Iram
Iram,
Small correction: do not use hardcoded value 2. Please use rb.newui.PAGE_TYPES.EDIT
It will provide better portability across versions.
Thanks, Thierry.
The full list of page types is:
rb.newui.PAGE_TYPES = {
GENERIC : 0,
VIEW : 1,
EDIT : 2,
NEW : 3,
SEARCH : 4,
SEARCH_RESULTS : 5,
STATUS : 6,
SELECTOR : 7,
EMAIL_SELECTOR : 8,// Used as substitution to TYPE_SELECTOR
TREE_SELECTOR : 9,
IMPORT : 10,
TEMPLATES : 12,
REP_LIST : 13,
REPORT : 14,
LOGIN : 16,
MASS_UPDATE : 17,
NEW_QUICK : 18,
CUSTOM_PAGE : 19,
WEB_LINK : 20,
QUESTIONS : 21,
LIST : 22,// List of records
SURVEY : 23,// Take survey
EMBED_QC : 24,
R_BIN_VIEW : 25
};
Hi Iram,
Can you please try using location.reload(true) it will load the current page.
Regards,
Shiva Duriseati
I find that using using location.reload(true) in Firefox causes a pop up message to appear before the page refreshes. Using
window.location=window.location; eliminates this problem.
David
Hello Shiva,
location.reload(true) will reload the current page. I am however interested in reloading the parent page which I can achieve by performing a window.parent.location.reload(true); but I would only like to reload once I am sure that the value in the edit page is saved i.e. perform a parent page reload on the post-save event. Any suggestions?
In next release we will provide more Ajax operations to improve the overall experience and performance of the product.
As a result, there will be a way to do the save operation with Ajax and you will get a notification when the Ajax operation is complete. Hopefully, this will help.
Thierry.
Iram, we do not have a custom client-side event on form submit success but instead user is re-directed away from edit-pages. Else, edit page is re-rendered with validation errors.
You can consider looking at the pop-up windows current page type. Client-side API: rb.newui.page.PageContext.getPageType()
Value 2 is for Edit Page.
Also, in case of form submit failure, the following API (redirect flag on validation failure) will return TRUE:
rb.newui.page.PageContext.isRedirectedOnServerValidation().
So, this way you can test for the negative case & decide when to reload the parent page.
Thanks Thierry, that's great to know.
Thanks Siraj for your answer. I shall give that a try and let you know how it goes.
Cheers.
Iram
Iram,
Small correction: do not use hardcoded value 2. Please use rb.newui.PAGE_TYPES.EDIT
It will provide better portability across versions.
Thanks, Thierry.
The full list of page types is:
rb.newui.PAGE_TYPES = {
GENERIC : 0,
VIEW : 1,
EDIT : 2,
NEW : 3,
SEARCH : 4,
SEARCH_RESULTS : 5,
STATUS : 6,
SELECTOR : 7,
EMAIL_SELECTOR : 8,// Used as substitution to TYPE_SELECTOR
TREE_SELECTOR : 9,
IMPORT : 10,
TEMPLATES : 12,
REP_LIST : 13,
REPORT : 14,
LOGIN : 16,
MASS_UPDATE : 17,
NEW_QUICK : 18,
CUSTOM_PAGE : 19,
WEB_LINK : 20,
QUESTIONS : 21,
LIST : 22,// List of records
SURVEY : 23,// Take survey
EMBED_QC : 24,
R_BIN_VIEW : 25
};
Note: the page type definitions above are only available as of V4.0.4.
Thus as Siraj pointed out till then use the value 2 (or better define the constant yourself)
I will wait for the release Thierry and then use the page type definitions as specified by you.
Cheers.
Hello Siraj,
I have the above mentioned code on form submit as given below that checks if the server validation is complete and the return page type is the view page but on form submit, the server validation returns false (which is correct) and the return page type returns 2 (Edit page). Any suggestions on how I can make sure the submission is complete?
if(rb.newui.page.PageContext.isRedirectedOnServerValidation() == false && rb.newui.page.PageContext.getPageType() == 1) { window.top.location.reload(); }
Iram, on form submit when the user is re-directed, the following page if it is an EDIT page signifies form submission failed. Else, it was a success.
That is you should not run this script on form submit but have it in the destination page where the user will get re-directed.
Understand that it is not that straightforward approach, but there is no custom event which signifies form submssion is success as there could be server-side validations that will cause record save to fail.
In case you do not have any server-side field custom validation or validation triggers configured, then you can simply check if client-side validation is a success.
For that, on form sbumit handler:
var formDetails = rb.newui.page.PageContext.getFormDetails(rb.newui.util.EDIT_FORM_NAME);
var validator = formDetails.getKendoValidator();
if (validator && validator.validate()) { //validation true...
window.top.location.reload();
}