:: Forum >> Version 2 >>

only one selected Checkbox in Grid

Hi all,

i have a problem with unchecking other checkboxes in a Grid when i check another.

Here is the Code:

var CellData = var CellData = [
                                [
0,"99917180","Nokia 6303i classic matt black","9,99"],
                                [
0,"99916954","Nokia 6700 slide petrol MyCommunity","4,95"]
                                ];
                                
var 
myHeaders = ["Wahl","Artikelnummer","Beschreibung","Preis"];

    var 
obj = new AW.UI.Grid
    
obj.setHeaderText(myHeaders); 

    
// setting cell text
    
obj.setCellText(function(c,r){return CellData[r][c]} );  
    
    
//Grid definitions
    
obj.setSize(500200); 
    
obj.setColumnCount(4);  
    
obj.setRowCount(2);  
    
obj.setColumnWidth(500);  
    
obj.setColumnWidth(1001);
    
obj.setColumnWidth(2902);
    
obj.setColumnWidth(503);
    
    
//Setting the ceckbox as template in column 0
    
obj.setCellTemplate(new AW.Templates.Checkbox0);
   
    
//setting cell values and text
    
obj.setCellValue(function(colrow){return CellData[row][0]==1 ? true false}, 0); 
    
obj.setCellText(function(colrow){return this.getCellValue(colrow"1" "0"}, 0);

    
//call this when changing the value of the checkbox 
    
obj.onCellValueChanged = function(valuecolrow){
       
//translate the boolean values to 0 or 1 
       
if (value) {
            
value=1;
            }else{
            
value=0;
            };
            for (
x=0;x<2;x=x+1)
            {
            if (
!= row) {
                
// HERE I WANT TO CHANGE THE CELL VALUE IN ROW x AND Column 0
                
alert(x);               
                }
            }
            if(
col == 0)
            
//alert with the values i need...
            
alert("SuplierAid:"+CellData[row][1]+ " Status:"+value);
            
//... in this function
            //update_memdata(CellData[row][1], value);
    
}
    
//writing Object
    
document.write(obj);
 
any suggestion how to do this?

greetz
skatanic
Thursday, October 7, 2010
Try placing:
this.getCellTemplate(col,row).refresh();
at the very end of onCellValueChanged function.
if(col == 0) {
......
} // don't forget to put '{}' in this block
this.getCellTemplate(col,row).refresh();
}
C++
Thursday, October 7, 2010
Also try:
var a = value;
if(a){
...

instead of single:
if (value) {
...
C++
Thursday, October 7, 2010
thanx for the reply but it doesn't work for me. I don't have a problem with checking this boxes.
I want it like this one here:

http://www.activewidgets.com/ui.radio/

greetz
skatanic
Thursday, October 7, 2010
Hi,

forget about it. Got the solution.

Here is the code:

var CellData = var CellData = [
                                [
0,"99917180","Nokia 6303i classic matt black","9,99"],
                                [
0,"99916954","Nokia 6700 slide petrol MyCommunity","4,95"]
                                ];
                                
var 
myHeaders = ["Wahl","Artikelnummer","Beschreibung","Preis"];

    var 
obj = new AW.UI.Grid

obj.setId("myGrid");
obj.setCellText(function(c,r){return CellData[r][c]} );
obj.setHeaderText(myHeaders);
obj.setColumnCount(4);
obj.setRowCount(' || v_handy.count || ');
    
obj.setColumnWidth(500);  
    
obj.setColumnWidth(1001);
    
obj.setColumnWidth(2902);
    
obj.setColumnWidth(503);
obj.setSelectorVisible(false);
obj.setSelectionMode("none");

var 
radio = new AW.Templates.Checkbox;
radio.setClass("toggle""radio");
radio.setClass("templates""radio");
obj.setCellTemplate(radio0);

    
    
obj.setCellValue(function(colrow){return CellData[row][0]==1 ? true false}, 0); 
    
obj.setCellText(function(colrow){return this.getCellValue(colrow"1" "0"}, 0);

    
    
obj.onCellClicked = function(valuecolrow){
    if(
col == 0) {
    var 
value
       
if (a) {
            
a=1;
            }else{
            
a=0;
            };
  
            for (
x=0;x<' || v_handy.count ||
                '
;x=x+1)
            {
            if (
!= row) {
                
obj.setCellValue(false,0,x);  
                
//alert(x);        
                
}
            }
            
            
alert("SuplierAid:"+CellData[row][1]+ " Status:"+a);
            
//update_memdata(CellData[row][1], value);
            
};
            
    }
    
   
document.write(obj);
 
skatanic
Thursday, October 7, 2010



This topic is archived.

Back to support forum

Forum search