:: Forum >> Version 1 >>

Alex, can you explain how the data model interacts with the UI?

Alex, I'm trying to create a simple control that has a UI element (DIV tag) and a data model. If I change the value of the data how does the DIV tag content get updated automatically. I'm trying to learn your widget framework but need help in some areas.

Thanks for any suggestions.
Steve N
Wednesday, June 8, 2005
Bump... anyone please?

(Note: I'm not using the grid, just the core methods of the toolset.)

This is what works... but I'm not convinced it's the way to do it:

// set the header title
obj.setTitle = function(sTitle) {
var oTitle = this.getHeaderTemplate().getContent("text");
oTitle.setContent("item", sTitle);
oTitle.refresh();
};
Steve N
Thursday, June 9, 2005
Steve,
If you create a new Object using "new Active.HTML.DIV" and you want to change the 'text content' of the DIV it is much easier to do:

var newDiv = new Active.HTML.DIV;
  
newDiv.setContent("this is the new content");
  
newDiv.refresh();
 
That should be easier to follow. If you want to change the innerHTML of the object it is almost the same, it looks like this:

var newDiv = new Active.HTML.DIV;
  
newDiv.setContent("html""<span>some stuff</span>");
  
newDiv.refresh();
 
I know these are simple examples, but it really is that simple.
After re-reading your first post, I may be mis-understanding all that you are doing and this may not solve your problem. If you post a little more code it might help me out more.

Jim Hunter
Friday, June 10, 2005
Thanks Jim,

The issue was trying to get the UI (View) to get updated when I made a change to the data (Model) using a setProperty() method. I realize now that I needed a callback function in the setContent() method to get the data from the model, and a refresh().

I figured it out through sheer perseverance in the end. Thanks all the same.
Steve N
Friday, June 10, 2005



This topic is archived.

Back to support forum

Forum search