PDA

View Full Version : Simply updating html on demand?



abcdef
4 Jul 2010, 12:20 AM
I am trying to do something very simple: I would like to change the html of a panel dynamically. Its not attached to a store. Its a very simple panel and I would like to update its html. At its simplest, an extract looks like this:

{
html: 'some text'
}

I would like to change the text to 'some other text', dynamically. Right now, I am doing something like:

this.html = 'some other text';
this.doLayout();

but this does not change the text, although I save its changed state on the server and when I reload the page, it picks up the value from its state and renders it correctly. But at the time that I change the value, I'd like to see the changed value on the panel.

How do I achieve this?

I tried using a template but its the same problem: it does not show the changed value at the time that the value is actually changed but it picks it up from the state when the page is refreshed.

As a note, the update function does change the value at runtime but throws an error when the page is refreshed (when its forced to pick the default value from the state) and throws this error: TypeError: Result of expression 'c' [undefined] is not an object.

Also with html and template, there are no errors thrown when the value is changed. It simply does not display the changed value.

I must be missing something pretty basic here? Can anyone please help me out?

Thanks in advance...

mankz
4 Jul 2010, 8:23 AM
yourPanel.update('Some new Html');

abcdef
4 Jul 2010, 10:04 AM
Thanks for replying back.

But like I said, I already tried that. Update does change the value at runtime but throws an error when the portlet is trying to initialize itself by reading from its state when the page is refreshed.

Template and doing pane.html = 'so new html', do the right thing when initializing on refresh but they do not update the html content at run time.

Is there a single function I can use that can handle both of the said functions?

For example, in Jquery, I can do something like: panel.html('some new html') and it will do the right thing at run time as well as while initializing on refresh.