So my users enjoy buttons that will pre-fill date fields (such as last month, last year, etc.). I figured there was no need to change the javascript code that calculates out these dates for every component and therefore I have been using the same function names (i.e. setLastMonthDate) and JS code in multiple UX components (with the date field controls probably 90% of the time having the same name in multiple components, such as start_date).
However, it seems if I have two or more of these components opened at the same time in a tabbed ui then only one of the components date fields will get changed even if I go to another tab and click on the buttons in that component, has anyone else experienced this type of thing? I was under the impression that putting Javascript code in the javascript declarations of a UX somewhat "sandboxed" the code to that component (whole reason for the {dialog.object} precursor I thought), is this not the case? Or is this a potential bug of the tabbed UI?
I instantly know when the issue occurs because many of these components call one of my "set date" functions in the client side onRenderComplete to pre-fill the date fields and the code runs but the date fields won't be set (and there by the list that I want to pre-filter won't be rendered).
Clarification: So when I have a UX open in a tabbed ui and then open a second one that is going to call the JS "set date" function I wrote with the same name it actually calls the function in the first UX component (i.e. its not calling the function in the current UX opening and then setting the date fields in the other one but rather it is calling the function defined in the first component that was already open).
Example: Open up a ux called ux1 in a tabled ui and the "set date" JS function I wrote called setLastMonthDate runs and sets the dates correctly and the list if filtered. Now I leave ux1 open in the tabbed ui and go to open ux2. When ux2 opens the setLastMonthDate function is suppose to be called within ux2 but rather the one defined in ux1 gets run and the dates in ux1 get changed. The dates in ux2 stay blank and therefore the list is never filtered on the dates like its suppose to be. Now if I try to click a button to call the same setLastMonthDate in ux2 it will run the function of the same name in ux1 (and this goes for any other set date JS function I try to run in ux2). Even after closing ux1 the function in ux2 won't work, I have to refresh my browser then just open ux2 by itself to get the functions to work again.
However, it seems if I have two or more of these components opened at the same time in a tabbed ui then only one of the components date fields will get changed even if I go to another tab and click on the buttons in that component, has anyone else experienced this type of thing? I was under the impression that putting Javascript code in the javascript declarations of a UX somewhat "sandboxed" the code to that component (whole reason for the {dialog.object} precursor I thought), is this not the case? Or is this a potential bug of the tabbed UI?
I instantly know when the issue occurs because many of these components call one of my "set date" functions in the client side onRenderComplete to pre-fill the date fields and the code runs but the date fields won't be set (and there by the list that I want to pre-filter won't be rendered).
Clarification: So when I have a UX open in a tabbed ui and then open a second one that is going to call the JS "set date" function I wrote with the same name it actually calls the function in the first UX component (i.e. its not calling the function in the current UX opening and then setting the date fields in the other one but rather it is calling the function defined in the first component that was already open).
Example: Open up a ux called ux1 in a tabled ui and the "set date" JS function I wrote called setLastMonthDate runs and sets the dates correctly and the list if filtered. Now I leave ux1 open in the tabbed ui and go to open ux2. When ux2 opens the setLastMonthDate function is suppose to be called within ux2 but rather the one defined in ux1 gets run and the dates in ux1 get changed. The dates in ux2 stay blank and therefore the list is never filtered on the dates like its suppose to be. Now if I try to click a button to call the same setLastMonthDate in ux2 it will run the function of the same name in ux1 (and this goes for any other set date JS function I try to run in ux2). Even after closing ux1 the function in ux2 won't work, I have to refresh my browser then just open ux2 by itself to get the functions to work again.
Comment