:: Forum >> Version 2 >>

get cell value dynamic

How I can do an alert of the cell value when I do click in a cell..

Thank you..
Leandro
Tuesday, December 13, 2005
Anyone can help me ???!!!

Thanks
Leandro
Wednesday, December 14, 2005
I found this solution...
obj.setCellLink("javascript:void(1);"1);
obj.setCellTemplate(new AW.Templates.Link1);    // and template
obj.onCellClicked = function(eventcolrow){if (col==alertthis.getCellText(colrow));}; 
Leandro
Wednesday, December 14, 2005
I cant get it too work on mine, do i need to have the template, can you please help?

here is my code

<html>
<
head>
<
title>Simple Freedom Outage Page</title>
<
stylebodyhtml {margin:0pxpadding0pxoverflowhidden;} </style>

<!-- 
ActiveWidgets stylesheet and scripts -->
    <
link href="grid.css" tppabs="grid.css" rel="stylesheet" type="text/css" ></link
    <
link href="aw.css" rel="stylesheet" type="text/css" ></link>
<
script src="aw.js"></script>
<
script src="grid.js" tppabs="grid.js"></script>

<!-- Include 
patches here -->
<
script src="paging1.js" tppabs="paging1.js"></script>

<!-- 
grid format -->
<
style>

.
active-controls-grid {height380pxfontmenu;}

.
active-column-{width80px;}
.
active-column-{width200px;}
.
active-column-{text-alignright;}
.
active-column-{text-alignright;}
.
active-column-{text-alignright;}
.
active-column-{text-alignright;}
.
active-column-{text-alignright;}

.
active-grid-column {border-right1px solid threedshadow;}
.
active-grid-row {border-bottom1px solid threedlightshadow;}

/* button styles */
a.buttona.buttonDis {
displayblock;
background-colortransparent;
background-imageurl(button.png);
background-repeatno-repeat;
width52px;
height24px;
padding3px 0 0 0;
text-aligncenter;
font-familyArialHelveticasans-serif;
font-size12px;
font-color#000000;
text-decorationnone;
cursor: default;
}
a.button:linka.button:visited {
color#000000;
cursor: default;
}
a.button:hovera.button:active {
background-position-24px;
color#000000;
cursor: default;
}
a.buttonDis:linka.buttonDis:visiteda.buttonDis:hovera.buttonDis:active {
background-position-48px;
color#5F5F5F;
cursor: default;
}
.
footer{
border1px solid black;
border-top-width1;
border-bottom-width1;
border-right-width0;
border-left-width0;
font-size10px;
Font-FamilyVerdanaGenevaArialHelveticasans-serif;
font-weightnone;
filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#FFB012'startColorstr='#FFCF54'gradientType='0');
}
</
style>

<!-- 
grid data -->
<
script>

var 
inputval="";

var 
Datalen 0;
var 
myData =[];
var 
GlobData =[];
var 
rowidValues = []; 
var 
resfilter "";
var 
restot "LOADING, PLEASE WAIT.";

var 
myColumns = ["Line Range""Rep Posted""When Reported""Ticket""Description""Update"];

// create ActiveWidgets data model - text-based table
var table = new Active.Text.Table;

// provide data URL - plain text comma-separated file
table.setURL("outages.txt");

// create javascript object
var obj = new Active.Controls.Grid;
obj.setModel("row", new Active.Rows.Page);
obj.setStatusProperty("code""loading"); 


var 
defaultResponse table.response;

//begin table response
table.response = function(data){
defaultResponse.call(tabledata);
Datalen=table.getCount();

//load CSV and convert to array
for(var x=0xDatalenx++) { 
GlobData.push([table.getTextx0), table.getTextx1), table.getTextx2), table.getTextx3), table.getTextx4), table.getTextx5)]); 
}


myData GlobData ;
restot Datalen ;

obj.setRowProperty("count"Datalen);
obj.setColumnProperty("count"6);
obj.getDataText = function(ij){return myData[i][j]};
obj.setDataText = function(valueij){myData[i][j] = value};
obj.setColumnProperty("text", function(i){return myColumns[i]});
//obj.setProperty("row/pageSize", 10);


// SET TIMEOUT ( )
window.setTimeout(function(){


obj.setStatusProperty("code""");
resfilter Datalen;
document.getElementById('result').innerHTML "<b>Number of matches : "+resfilter+" of: " restot +"</b>"
goToPage(0);
}, 
0); //(end of TIMEOUT)
 
//(end of tableresponse method)

// start asyncronous data retrieval
table.request();


function 
populateListBox() { 
for(var 
c=0c<myColumns.lengthc++) { 
document.write("<option value="+c+">"+myColumns[c]+"</option>"); 

document.write("<option value= myColumns.length>All Columns</option>");


function 
ReadThisListBox(){ 
document.write("<option value=0>Begin With</option>"); 
document.write("<option value=1>Contains</option>"); 

//*********************************************
function FilterGrid() { 
myData =[];

obj.setStatusProperty("code""loading"); 
obj.refresh();



var 
colToBeSearched document.forms['gridSearchForm'].colSearchName.value
var 
WhereToBeSearched document.forms['gridSearchForm'].BeginContains.value

var 
toSearch inputval
var 
res 0;


if(
colToBeSearched myColumns.length){

if(
WhereToBeSearched == ) {
for(var 
x=0x<GlobData.lengthx++) { 
if ( 
GlobData][ colToBeSearched ].toUpperCase().substr(0toSearch.length) == toSearch.toUpperCase().substr(0toSearch.length) ) {
myData.push(GlobData[x]);
res++; 


}

if(
WhereToBeSearched ==1){
for(var 
x=0x<GlobData.lengthx++) { 
if((
GlobData[x][colToBeSearched].toUpperCase().indexOf(toSearch.toUpperCase())) >= 0) { 
myData.push(GlobData[x]);
res++; 


}

}

else {

if(
WhereToBeSearched == ) {
for(var 
x=0x<GlobData.lengthx++) { 
for(var 
y=0y<GlobData[x].lengthy++) { 
if ( 
GlobData][ ].toUpperCase().substr(0toSearch.length) == toSearch.toUpperCase().substr(0toSearch.length) ) {
myData.push(GlobData[x]);
res++;
break; 


}
}
if(
WhereToBeSearched ==1){
for(var 
x=0x<GlobData.lengthx++) { 
for(var 
y=0y<GlobData[x].lengthy++) {
if((
GlobData[x][y].toUpperCase().indexOf(toSearch.toUpperCase())) >= 0) { 
myData.push(GlobData[x]);
res++; 
break;


}
}




}


obj.setCellLink("javascript:void(1);"1); 
obj.setCellTemplate(new AW.Templates.Link1);    // and template 
obj.onCellClicked = function(eventcolrow){if (col==alertthis.getCellText(colrow));};

obj.setModel("row", new Active.Rows.Page);


if(
res>0){
resfilter res;
obj.setRowProperty("count"res);
}
else{
resfilter 0;
myData = [[" NOT FOUND"" NOT FOUND"" NOT FOUND"" NOT FOUND"" NOT FOUND"" NOT FOUND"]];
obj.setRowProperty("count"1);
}

obj.getDataText = function(ij){return myData[i][j]};
obj.setDataText = function(valueij){myData[i][j] = value};

window.setTimeout(function(){
obj.setStatusProperty("code""");
goToPage(0);
document.getElementById('result').innerHTML "<b>Number of matches : "+resfilter+" of: " restot +"</b>"
}, 
0);


///***************************************

</script>
</
head>
<
body>
<!-- 
top page control buttons -->

<
script>

// write grid html to the page
document.write(obj);

</
script>

<
script>
<!-- 
First -->
    var 
firstbutton = new AW.UI.Button;
    
firstbutton.setControlText("First");
<!-- 
Previous -->
    var 
previousbutton = new AW.UI.Button;
    
previousbutton.setControlText("Previous");
<!-- 
Next -->
    var 
nextbutton = new AW.UI.Button;
    
nextbutton.setControlText("Next");
<!-- 
Last -->
    var 
lastbutton = new AW.UI.Button;
    
lastbutton.setControlText("Last");
</
script>

<
script>
<!-- 
First -->
    
document.write(firstbutton);
    
firstbutton.onClick = function(){
    
goToPage(-Infinity); }
<!-- 
Previous -->
    
document.write(previousbutton);
    
previousbutton.onClick = function(){
    
goToPage(-1); }
</
script>
<!-- 
bottom page control buttons -->
<
span id='pageLabel'></span>

<
script>

<!-- 
Next -->
    
document.write(nextbutton);
    
nextbutton.onClick = function(){
    
goToPage(1); }
<!-- 
Last -->
    
document.write(lastbutton);
    
lastbutton.onClick = function(){
    
goToPage(Infinity); }
</
script>

<
script>

function 
GETINPUTVAL(e){
inputval ;
FilterGrid();
}

function 
goToPage(delta){
obj.setProperty("row/pageSize"20);
var 
count obj.getProperty("row/pageCount");
var 
number obj.getProperty("row/pageNumber");
number += delta;
if (
number 0) {number 0}
if (
number count-1) {number count-1}
document.getElementById('pageLabel').innerHTML "Page " + (number 1) + " of " count " ";

obj.setProperty("row/pageNumber"number);
obj.refresh();
}

</
script>

<
form name=gridSearchForm 
<
select name=colSearchName
<
script
populateListBox();
</
script
</
select>
<
select name=BeginContains
<
script
ReadThisListBox();
</
script
</
select>
<
input id="autocompleteinput" type=text name=keyword onKeyUp="GETINPUTVAL(this.value);//event.returnValue = event.keyCode;"
</
form
<
div id=result
</
div

<
script
document.getElementById('result').innerHTML "<b>Number of matches : "+resfilter+" OF: " restot +"</b>"
</
script
<
br>
<
br>

</
body>
</
html
StrykstaGuy
Thursday, December 29, 2005
Try this:
obj.onCellClicked = function(eventcolrow) {
    
alert("row: " row " - col: " col " - val: " this.getCellText(colrow));
}
 
Brad Anderson
Thursday, December 29, 2005



This topic is archived.

Back to support forum

Forum search