:: Forum >> Version 1 >>

How to add Avtive grid table to particular div

I have used your active widget grid in html. its working fine if i add scripts to head as head.addElement(getGridFormat());
head.addElement(getGridHeader(header));
head.addElement(getGridData(value, check, value.length, field.length));
and atlast grid script to form.. as below
frm.addElement(getGridScript(value.length, field.length, 28, 20));

But if i want it to be added to any specified div... how to do ? If i add all 4 scripts to form and add that form to div its not coming..........
Lokesh.Madanbhavi
Monday, December 19, 2005
Show us how you are doing it so that we can check your code.
Jim Hunter
Monday, December 19, 2005
hai, Am using the same script which u has been provided in version1.0 relaesed. and as i told am adding first 3 script ie
getGridFormat()
,getGridHeader(header)
,getGridData(value, check, value.length, field.length));
to head of html and then atlast getGridScript(value.length, field.length, 28, 20))
to form and that form to body of html... AT THIS TIME This table is working finely But
IF i want to put it in any div it is not working ....... Is it possible to add this grid in div........
Tuesday, December 20, 2005
Yes, you can.. I always draw my grid in a div..

To do this.. you need the grid loaded first.. so always do this after window onload event.

<script>

AW.attachEvent(window"onload"DrawGrid);

function 
DrawGrid(){
    var 
obj = new AW.Grid.Extended;

    
obj.setCellText(myData);    // 2-dimensional js array
    
obj.setHeaderText(myHeaders);    // js array (see top of this page)

    
obj.setColumnCount(5);
    
obj.setRowCount(20);

    
// document.write(obj); // Do not use this after onload at any cause
    
document.getElementById("gridCanvas").innerHTML=obj;
}

</
script>

<
div id="gridCanvas"></div>

 
Another classic method is


<div id="gridCanvas">
<
script>
    var 
obj = new AW.Grid.Extended;

    
obj.setCellText(myData);    // 2-dimensional js array
    
obj.setHeaderText(myHeaders);    // js array (see top of this page)

    
obj.setColumnCount(5);
    
obj.setRowCount(20);

    
document.write(obj);
</
script>
</
div>
 
In my observation the second method is faster.. But the first method has control over which div element it would go to.

HTH
Md. Sheriff, Drivestream
Tuesday, December 20, 2005
A small correction:

To do this.. you need the *document* loaded first.. so always do this after window onload event.

Regards
Md. Sheriff, Drivestream
Tuesday, December 20, 2005
You can do it during load. BUT the DIV has to be closed first. I do this all the time:

<DIV id=myDiv>
</
DIV>
<
script>
= new AW.UI.Grid;
document.getElementById("myDiv").innerHTML a;
</
script
I have used this method many times before switching entirely to AW objects (yes, I have not hand coded HTML in my app)
Jim Hunter
Tuesday, December 20, 2005



This topic is archived.

Back to support forum

Forum search