3.0.0

grid is not displayed if alert is removed

Hi,
Here is my code if i remove the last alert be4 document.write (obj) then the grid is not getting displayed even.
var obj = new AW.UI.Grid;

// var obj1 = new AW.HTML.DIV;
//alert(obj1);
var demo;
function onBodyLoad()
{
//create ActiveWidgets Grid javascript object
document.write("<style>#myGrid {height: 200px; width: 350px;}#myGrid .aw-row-selector {text-align: center}#myGrid .aw-column-0 {width: 150px;}#myGrid .aw-column-1 {width: 200px;}#myGrid .aw-column-2 {text-align: right;}#myGrid .aw-column-3 {text-align: right;}#myGrid .aw-column-4 {text-align: right;}#myGrid .aw-grid-cell {border-right: 1px solid threedlightshadow;}#myGrid .aw-grid-row {border-bottom: 1px solid threedlightshadow;}/* box model fix for strict doctypes, safari */.aw-strict #myGrid .aw-grid-cell {padding-right: 3px;}.aw-strict #myGrid .aw-grid-row {padding-bottom: 3px;}</style>");

var data;
var myData;
var myColumns;
var iddata;
var newtxt;
var temp;
var ajaxRequest5;
//var obj = new AW.UI.Grid;
obj.setId("myGrid");

var url ="http://10.76.165.98:8084/newtry/try.jsp";

var ajaxRequest4 = new Ajax.Request(url,
{
method: 'get',
onSuccess: function (abc)
{
var loop=0;

var str=abc.responseText;
//alert("hey5"+str);

demo=str.split("#");

//alert("here is this");

myData=new Array(demo.length);
myColumns = ["TO DO TASK", "ID"];
//alert("2"+demo.length);

for(loop=0;loop<demo.length-1;loop++)
{
for(loop1=0;loop1<1;loop1++)
{
myData[loop]=demo[loop].split("~");
//alert(myData);


}
}



// define data formats
var str1 = new AW.Formats.String;
var num = new AW.Formats.Number;

obj.setCellFormat([str1,num]);

// provide cells and headers text
obj.setCellText(myData);
obj.setHeaderText(myColumns);

//alert("This is 1st element"+myData[0][0]);

//set number of rows/columns
obj.setRowCount(demo.length-1);
obj.setColumnCount(2);

// enable row selectors
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});

// set headers width/height
obj.setSelectorWidth(28);
obj.setHeaderHeight(20);

// set row selection
obj.setSelectionMode("single-col");



// validating (Enter)

obj.onCellValidating = function(text, col, row)
{ if(col==1)
{
// set editable
obj.setCellEditable(false);
}
iddata=this.getCellText(1,row);
newtxt=this.getCellText(col,row);
//alert(newtxt);
var url2="http://10.76.165.98:8084/newtry/update.jsp?idd="+iddata+"&new="+newtxt;
//alert(url2);
ajaxRequest5 = new Ajax.Request(url2,
{
method: 'get',
onSuccess: function (abc)
{
var str3=abc.responseText;

}
});


};

// set click action handler
obj.onCellClicked =function edit(event,col,row)
{ if(col!=1)
{
data=this.getCellText(col,row);

window.status = this.getCellText(col,row);
//alert(col+" "+row);
// set editable
obj.setCellEditable(true);
}
else
{
obj.setCellEditable(false);
}

};

}



});
//obj2=setTimeout("document.write('<div>' + obj + '</div>');",5000);
alert("WELCOME ,TO CONTINUE PRESS OK");
//document.getElementById(div).innerHTML = obj;
//alert("hello");
//obj1.setContent("message",obj);
// alert(obj1);

document.write(obj);
//document.write("<div>" + obj + "</div>");
// alert(obj.toString);
//obj.refresh();


}
smiti
April 4,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.