3.2.0

How the grid is rendered??

Hi,

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
December 1,
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>
</div>
<script>
document.getElementById("myDiv").innerHTML = myGrid;
</script>

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
December 1,
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?

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

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
December 2,
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)
December 2,

This topic is archived.

See also:


Back to support forum