views:

15

answers:

0

Hello there,

We develop our pages based on HTC element behaviors (let's call them 'htc' for short). One of the components is a dataGrid.htc which has many dataGridItem.htc inside of it. These items are created on demand.

So, in dataGrid.htc I import the item:

<html xmlns:dataGrid>
<head>
<?import namespace="dataGrid" implementation="dataGridItem.htc" />
</head>
(...)

To create the items, I use the following syntax:

(...)
var dataGridItem = document.createElement("dataGrid:dataGridItem");
dataGridItem.someMethod();
(...)

The problem is: when I open my testDataGrid.htm file with 'file://' protocol, it works perfectly. But, when I open with 'http://' protocol, I have some problems because createElement() is not synchronous and the item is not "ready" yet. So, in the line:

dataGridItem.someMethod();

the browser shows an error because this method does not exist yet.

Is there any way to create the elements with some "synchronous" behavior? Or is there another way to do it?

Thank you in advance.