DOM "load" event registration

oliverp's picture

Hi all,

I' am applying a jquery call to the Sync.RemoteTable.renderAdd() to add some nice client features, but it doesn't work intially. However it does work if a property is updated after it was rendered. The jQuery call adds client side multiple sorting and paging.
Why doesn't it work intially (rendering the first time)?
Sync.RemoteTable.js

renderAdd: function(update, parentElement) {
       ...
       var renderIdSelector = "#" + this._table.id.replace('.', '\\.');
       jQuery(renderIdSelector).tablesorter();
}

My idea is registering for an event so late, that it finally works initially. Thus I'am searching for a possibility to register for the DOM event "load" (http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-htmlevents) or something like this in order to refresh a table. Does Echo3 have a very late event I can use in order to be happy?

This is because child

This is because child components render in an unattached DOM-tree, for performance reasons. You can either implement the renderDisplay method, which gets called once all elements are on the screen, or try to find a way to pass the actual element to jQuery yourself, rather than working with selectors (which are slow in a certain browser).

Niels

oliverp's picture

Thanks, this works

Thanks,
this works perfectly! I should have read the jQuery section about selectors before... Nevertheless I can now offer the nice echo Table as client sortable through jQuery tablesorter. I have to clean it up and give to the echopoint (https://echopoint.dev.java.net/).

$(this._table).tablesorter();

By the way, why does the Sync.Remote.Table.js" use only a tbody including all rows and the header row instead of thead and tbody element containing the rows?

Great, thanks for

Great, thanks for sharing.

About the thead: that's a good question. To support that, we would have to add some kind of means of designating rows as header. Do you know how many browsers support non-scrolling table headers? If there's good support, I would be willing to look into implementing this.

Niels