3.2.0

hide cell data

I am trying out the trial version.
Managed to get the background of the cells with data red.
Next step is to hide the data in these cells because we don't want them to be publiced on the net

Tried a few things but no luck so far.
Can anyone give me a hint?

Thanks Mark
please check below on item set cell text.
How should this be made up?


var obj = new AW.Grid.Extended;

// new property for column span, default=1
obj.defineHeaderProperty("span", 1);
obj.setHeaderTemplate(new AW.Grid.Header2);
obj.setHeaderIndices([1,0]);
obj.setHeaderCount(2);

// refresh multi-span headers on width change
obj.adjustScrollWidth = function(){
var c, r, max = this.getColumnCount();
var a = this.getColumnIndices();
for (r=0; r<2; r++){
for (c=0; c<max; c++){
var row = r, col = a ? a[c] : c;
if (this.getHeaderSpan(c, r) > 1){
this.getHeaderTemplate(c, r).refresh();
}
}
}
}

// usage
obj.setHeaderSpan(2, 0, 1);
obj.setHeaderSpan(0, 1, 1); // col-1 spans across 3 columns
obj.setHeaderSpan(4, 2, 1); // col-2 span=0 (hidden)
obj.setHeaderSpan(0, 3, 1); // col-3 span=0 (hidden)
obj.setCellText(myData);
obj.setHeaderText(["Variety", "Flowertype", "wk 46", "wk 47", "wk 48","wk 49","wk50","wk51","wk 52","wk 1","wk 2","wk 3","wk 4","wk 5","wk 6","wk 7","wk 8","wk 9","wk 10","wk 11","wk 12","wk 13","wk 14","wk 15","wk 16","wk 17","wk 18"],0); // js array for the second row of headers
obj.setHeaderText(["Schedule 2006-2007","","Estimated Flowerweeks",""],1);
obj.defineCellProperty("background-color", function(col,row){

var value = this.getCellText(col,row);
var color = "";
if (value > 1) {color = "red" ;}

return color;
});
obj.getCellTemplate().setStyle("background-color", function(){return this.getControlProperty("background-color"); });

// obj.setCellText(
// function(col,row) {
//if (col!= 1) { return(myData); }
// var v = this.getCellText(col, row);
// if (v = "") {
// return "Low";
// } else {
// return;
// }
// }
// );

//obj.setCellText(function(col, row);
//obj.setCellText(function(col, row){
// var value1 = this.getCellText(col, row);
// var text1 = "";
// if (value1 > 1) {text1 ="x" ;}
// return text1;
// }); // calculate column 2 from columns 0 and 1
//obj.getCellTemplate().setStyle("text", function(){return this.getControlProperty("text"); });


obj.setColumnCount(27);
obj.setRowCount(60);
obj.setFixedLeft(2);
obj.setControlSize(750, 500);


// document.write(obj);



Mark Wester - Holland
October 14,
Hey Mark,

I use the following:

obj.setCellText(function(col,row) {
            if (this.getCellValue(15, row) == 'true'){
                return "";
            }, 1)
;


Where column 1 has a type 'money' as follows:

var money = new AW.Formats.Number;  
            money.setTextFormat("#.###,##"); 
            money.dataToText1 = money.dataToText; 
            money.dataToText = function(data){
                return data ? this.dataToText1(data) : ""; 
        }


Sure you can get the drift else shout!

John Sourcer
October 16,
Hi John,

thanks for the answer but how to extract the value's from the datatable instead of the actual cells?
What would be the script for that?
something like this? :
obj.defineCellProperty("background-color", function(col,row){ 
 
    var value = [i][u]this.get my table data (col,row); [/u][/i]
    var color = "";
    if (value > 1) {color = "red" ;}
     
    return color; 
});  
obj.getCellTemplate().setStyle("background-color", function(){return this.getControlProperty("background-color"); });


thanks, mark
mark wester - holland
October 16,
Hi Mark,

I may be missing the point here but surely the same code works? I use this for row colouring dependent on a value in the grid:

obj.defineRowProperty("bgcolor", function(row){
    	    	    
    	    switch (this.getCellValue(13, row)){    	        
    	        case '6':
    	        case '7':
    	            return "F9F7ED";
    	        break;
    	        case '1':
    	        case '2':
    	        case '3':
    	        case '4':
    	        case '5':
    	            return "C3D9FF";
    	        break
    	    }        
        });  

        obj.getRowTemplate().setStyle("background-color", function(){  
            return this.getRowProperty("bgcolor");  
        });


John Sourcer
October 16,
Dear John,

Thanks for the quick answer but my point is, that I don't want the cell color dependent on a value in the grid, but on a value in a data table, defined in for example "mydata".
Background coloring is working fine based on grid value's but problem is, I don't want customers to see the value's in the grid.
So I don't want to fill the cells with data, but yet I like to change background of the cells based on those data.
Please find simple example at: http://www.triflor.nl/broeischema.htm

Thanks, Mark

mark wester - holland
October 16,
Ahh! Then stick the values in a column at the end of the grid and hide the column i.e:

Set column count to 13:

obj.setColumnCount(13);


Actually there are 14 cols, the 14th one containing the value you require as below:

obj.defineRowProperty("bgcolor", function(row){ 
                     
            switch (this.getCellValue(14, row)){                 
                case '6': 
                case '7': 
                    return "F9F7ED"; 
                break; 
                case '1': 
                case '2': 
                case '3': 
                case '4': 
                case '5': 
                    return "C3D9FF"; 
                break 
            }         
        });   

        obj.getRowTemplate().setStyle("background-color", function(){   
            return this.getRowProperty("bgcolor");   
        });


Dit lyk soos a klomp mooi kleure vir daai blomme!
John Sourcer
October 16,
BTW, you could of course change the colour of the cell and then setCellText to "", so that your users couldn't see the data.
John Sourcer
October 16,
John,

Your last message sound like a very good idea.
Problem is, I don't know exactly how the syntax should be.

If have this, but then I get all kinds of error messages
obj.setCellText( 
      function(col,row) { 
        var value = this.getCellText(col, row);
        var text = "";
        if (value > 1) {text ="";} 
                return text; 
            }) 
;


Should there be some kind of obj.template behind this?
by the way, beautiful dutch language you have written down

Mark
mark wester - holland
October 17,
Geen probleem:

The following code puts "" into column 0 when column 15 is 'false'. Column 15 in this instance is hidden:

obj.setCellText(function(col,row) {
            if (this.getCellValue(15, row) != 'true'){
                return "";
            }         
        }, 0);
John Sourcer
October 17,
John,

I get some cell with undefined. Probably I because there is no 'untrue' value. How to fit this into the syntax?

thanks, mark
p.s. by the way, ended up with coloring the numbers in the same color as the background. Do you have any comments on: www.triflor.nl/broeischema.htm ?

mark
mark wester - holland
October 18,
Dagse Mark,

Not 100% sure what you mean. You're going to have to post some code.

Table on your site looks fine. I would however keep the gridlines on as it makes viewing the vertical columns a lot quicker, helping to rapidly identify which weeks the varieties are available. Maybe even a change column colour on mouse over!
John Sourcer
October 19,
Hi John,

Thanks again for your comments.
Figured out that when you print the whole thing on a standard laser printer, the value's appear. So I have to set up the whole grid on your way.

Would this work?
obj.setCellText(function(col,row) { 
            if (this.getCellValue(3+15, row) != 'true'){ 
                return ""; 
            }          
        });

In this way I can copy my whole data scedule and paste it behind the original one. Also I do not have to make this for every cell.

Thanks again, Mark
mark wester - holland
October 19,
Hey Mark,

obj.setCellText(function(col,row) {  
            if (this.getCellValue(3+15, row) != 'true'){  
                return "";  
            }           
        });


3 + 15? Nope I don't think so. What does the 3 + 15 mean?
John Sourcer
October 19,
John,

Could it be something like this:
CellValue(col+15,row)!='true')

col+15 is the hidden colomn. For each column in the grid, it has to use the data of 15 columns further to adjust background.

Mark
mark wester - holland
October 22,
I suspect that could work or a derivative thereof!
John Sourcer
October 23,

This topic is archived.

See also:


Back to support forum