Lucius
Posts: 220
|
| Posted: 10/01/2012, 4:49 AM |
|
Hi,
I have encountered an issue with Update Panel and before I will submit it to support, I thought I would ask if anyone noticed it too or maybe even solved the issue...
I am using PHP as the coding language and newest CCS v5.
The issue is that on a page that has some content under Update Panel (no matter how complicated) the first time Update Panel is used it seems to be buggy during that first refresh.
I see two symptoms of this:
1. Visual
I have a "loader" implemented for a web page (an absolute DIV covering whole page with a GIF "loading..." message, hidden OnLoad by javascript) and on the first time page refreshes under update panel it is never shown. This loader replaces the standard red "Loading..." message you see for Update Panel in the top right corner of CCS generated pages.
Also if there is a Navigator component under a Grid you can see that for a brief amount of time it is displayed broken while Update Panel refreshes.
Most likely there are more such visual quirks examples, but it is always only the first time Update Panel refreshes, next refresh it works fine.
2. Warnings in Firebug
Each time the first refresh for Update Panel is done, I can see those following warnings in Firebug:
ReferenceError: reference to undefined property response.headerJSON
if (Object.isFunction(responder[callback])) {
prototype.js (wiersz 1347)
ReferenceError: reference to undefined property responder[callback]
if (Object.isFunction(responder[callback])) {
prototype.js (wiersz 1347)
ReferenceError: reference to undefined property object.toTemplateReplacements
if (object && Object.isFunction(object.toTemplateReplacements))
prototype.js (wiersz 675)
Again the above warnings only show once, on the initial refresh.
I would ignore it but the issue seems to be more annoying in complicated pages. I have a sequential search page (when you choose values from dropdowns and it refreshes next available values) under Update Panel and it is quite complicated in HTML and heavy in JS. Anyway there is an issue that during first refresh of Update Panel, some of the dropdowns will lose their event bindings and stop working, until next Update Panel refresh... I have checked that it's not because of any errors in JS or errors in page logic, so it seems to be connected to the above problem.
Please let me know if you have any input or ideas, thanks.
|
 |
 |
bannedone
Posts: 273
|
| Posted: 10/01/2012, 6:40 AM |
|
Hi
Sounds to me that the calls to the prototype functions are possibly getting called before the actual DOM element is loaded by the browser.
This might explain why it only happens on the initial load and all subsequent refreshes work OK because the objects are cached.
Maybe try delaying those things by using the jQuery ability to wait for the page to be ready
I can't remember off the top of my head the syntax for that but a google search should find it for you.
Just a thought.
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2 |
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 10/01/2012, 3:43 PM |
|
You are lucky to even get it to work at all.
When I add an update panel, it just doesn't display on my page.
Much the same as tabbed view doesn't display, but support couldn't rectify that issue.
With regard to dropdown listboxes temporarily losing their values, if dependent listboxes were created on one page and then added as a feature on another, it's advisable to check the event handlers. I also have noticed if an event handler is not correctly named for one set of dependent listboxes on a page that it can affect the operation of other dependent listboxes on that same page.
_________________
Central Coast, NSW, Australia.
|
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 10/09/2012, 1:53 PM |
|
I got a response from support saying that the update panel cannot be applied to existing panels, forms and grids and that is has to be created first and then they have to be cut and pasted in.
My question back is why did CCS 5 let me add the update panel around them in the first place?
What is so different about adding an update panel to existing and creating the AJAX wrapper in code manually?
Does anyone know how to add the update panel wrappers manually?... as cutting and pasting my forms and grids will likely result in mess all over the place as CCS breaks links all over the shop and there is nothing worse that having a variable created in the _events file trying to set the value on a class name in the .php file.
_________________
Central Coast, NSW, Australia.
|
 |
 |
Lucius
Posts: 220
|
| Posted: 10/30/2012, 8:09 AM |
|
MichaelMcDonald,
Yes this is totally silly. I am able to create a Record, switch to HTML mode, select it and then add an update panel to it. Update panel will work ok. However if I add a dependent listbox to such structure it will not work correctly.
But if I create update panel, place a Record and the add dependent listbox - then it will work correctly.
This is not a very intuitive and I agree if first method breaks something it should not be allowed...
|
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 11/01/2012, 5:08 AM |
|
Do you have prototype DLB's working in an update panel?
_________________
Central Coast, NSW, Australia.
|
 |
 |
saseow
Posts: 744
|
| Posted: 11/01/2012, 6:12 AM |
|
I have had problems with the update panel in the past. The problems were caused by CCS treating the "Include User Scripts" as modified if any changes were made to the HTML page. It broke the AJAX code.
The solution was to delete the code block from Include User Scripts to End Include User Scripts and to regenerate with F8. My problem was not the same as yours but wonder if they could be connected.
|
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 11/01/2012, 6:39 AM |
|
I just got it all working. What I have noticed, when an update panel is added and a form / grid pasted into it, the names (id's) of all components are now suffixed with the updatepanel name. I had existing dep. listboxes and they no longer worked after this name suffixing. What I found is that the update panel generation causes a completely new set of event handlers and references the components with the newly suffixed id's. At this stage, they did not work. What i have done is manually written event handlers using the old (unsuffixed) name and very important to do this - remove these newly generated event handlers completely, including button event handlers for good measure. Also, the dependent element had to be renamed so as to be without the suffix... What this seems to do is allow the dependent listboxes to be addressed independently of the update panel, and it works in insert mode and edit mode so far 100%.
It's a bit curly and you might have to play with. My updatepanel is called updatepanelrecordAsset and the form is called recordAsset.
Here is code for DLB
//updatepanelrecordAssetassettypeidPTDependentListBox1 Start @4472-7124058F
function updatepanelrecordAssetassettypeidPTDependentListBox1_start(sender) {
if (!sender || sender === window) return;
var dependentElement = $("recordAssetassettypeid" + sender.id.substring(45));
Here is event handler
addEventHandler("recordAssetassetclassid", "change", updatepanelrecordAssetassettypeidPTDependentListBox1_start);
addEventHandler("recordAssetassetclassid", "load", updatepanelrecordAssetassettypeidPTDependentListBox1_start);
Only thing is, every single time the page is re-generated it re-creates a new set of event handlers that screw the pooch and all this has to be done again. [
_________________
Central Coast, NSW, Australia.
|
 |
 |
|