:: Forum >>

How the grid is rendered??


I have a doubt, that can be simple to some people:

how the grid is rendered on the browser, trough document.write?
cause the source of the ActiveWidgets Grid, have no html code...
Is there some references about it?

Thanks for all

Adolfo Eloy
Adolfo Eloy Nascimento
Thursday, December 1, 2005
whenever you reference a grid object, it returns it's HTML by default unless you are accessing a property or method. So if you use a statement like:

alert(mygrid); // where myGrid is you already created grid

you will get an alert box filled with the grid HTML. Having said that, if you do something like:

<div id=myDiv>
document.getElementById("myDiv").innerHTML = myGrid;

then your grids HTML will be placed inside the DIV enabling you to put your grid, or any other AW control, inside DIVs or Table cells or ???

Hope this helps.
Jim Hunter
Thursday, December 1, 2005
Thanks Jim,

but my doubt is more in javascript, because
I don't understand how that object structure made by source code of AW grid,
can be writted in html (div's and etc)...
what block of code from source has the function, or descriptions to write this html code?

Adolfo Eloy Nascimento
Friday, December 2, 2005
The html is compiled from the grids current setup and the result is what you are seeing in the browser.
Friday, December 2, 2005

sorry for my insistence, but I'd like to know how the grids compile it.
I know that I need more javascript knowledge, but I don't know how learn it, because
I didn't found documents, books to learn myself about it.

one more time, sorry for my insistence,
and Thanks for help

Adolfo Eloy Nascimento
Friday, December 2, 2005
HTML is compiled by obj.toString() method defined in AW.System.HTML,

file: /source/lib/system/html.js (line 615 in 2.0beta3)

This method takes object tag, id and goes through defined attributes, classes, styles and events to produce HTML output, like

<span id="myGrid" class="aw-grid-control ..." style="..." >...</span>

Method toString() is called implicitly by javascript in cases where you need string representation of an object. Because of that you can use document.write(obj) or div.innerHTML = obj and in both cases the AW object will be converted to HTML string by calling obj.toString() method.
Alex (ActiveWidgets)
Friday, December 2, 2005

This topic is archived.

Back to support forum

Forum search