3.0 beta 2

how to make a master cell for the rest of the cells in the same column

how to make a master cell for the rest of the cells in the same column - basically changing the value of the first cell will set this value to the rest of the cells in the same column?
c_figer
November 16,
so the AW cant do that? hope someone help me on this. Do you, alex, help people if questions like this arise?
c_figer
November 16,
Basically using the information located inside posts #20459 , 20889 , 20911 and might need one or two more.
But please for posting questions within questions use the command "WHILE" is shorter.
Thanks
Carlos
November 16,
You can assign the value to all cells in a column if you use only column argument (row=undefined) -

grid.setCellText("abc", 1); // sets text in all rows in column-1
Alex (ActiveWidgets)
November 16,
ok - looks easy - how about setting all cells in the same column but from the listbox that was placed in the header not in the row? - this has been a real problem in AW so far -
c_figer
November 16,
something like - onHeaderTextChanged - is it possible?
c_figer
November 16,
also there is no way to place an icon in the second header's selector? if there is how would you put in?

this does not work:

obj.setSelectorImage("world", 0);


this does not work:


obj.setHeaderImage("world", 0);


cause they are being placed in the wrong spots - so what would be the right code line to place an icon in the selector area of the second header?
c_figer
November 16,
ok - i worked this one out with:

obj.setTopImage("world", 1);

which is exactly what i needed -


but what about the master input in the sub-header - so once i put something in - then all the cells underneath of it get filled up automatically?
c_figer
November 16,
ok - im getting closer:


obj.onCellTextChanged = function(text, col, row){
if (col==0&&row==0) obj.setCellText(text, 0);
obj.refresh();
}


this only works when the first row cell is being used as a master cell for all other cells below it -

but thats a bit different than i intend to design - is to make the same but with the sub-header cell which is supposed to stay neutral until i type something into it - then all the cells below it will have its sub-header value -

can this be accomplished in AW grid? Alex?
c_figer
November 17,
hmm - alex - did you know that second header (sub header) is treated by the grid as a seond plain row - so if i check on which input comes from - then the onCellTextChanged returns values from both from second header cell and the second row cell - they are the same - no difference for the grid -

my question is - am i stuck and cannot second header for the master cells for each column in the grid???

THIS IS VERY URGENT! NEEDS A RIGHT SOLUTION - OTHERWISE I WASTED 400 USD ON IT - !!!
c_figer
November 17,
I guess you are trying to make something like this -

var myHeaders = [
    ['Header 1', 'Header 2', 'Header 3'],
    [] // second row empty
];

var myCells = function(col, row){return col + "." + row};

var grid = new AW.Grid.Extended;
grid.setHeaderCount(2);
grid.setHeaderText(myHeaders);
grid.setCellText(myCells);

grid.setColumnCount(10);
grid.setRowCount(1000);
grid.setCellEditable(true);

for (var i=0; i<10; i++){
    var input = new AW.UI.Input;
    input.onControlValidated = function(text, col){
        this.setTimeout(function(){
            grid.setCellText(text, col);
            grid.getRowsTemplate().refresh();
        });
    }
    grid.setHeaderTemplate(input, i, 1);
}

document.write(grid);


You should use AW.UI.Input control in each header, and also use onControlValidated evevt instead of on...TextChanged (because onTextChanged fires on each typed character).
Alex (ActiveWidgets)
November 17,
i have 2 controls - combo with list inside thats in 1st cell of the subheader and input field in the 2nd cell of the same subheader -

i select an option from the list/combo and want the rest of the cells underneath of it filled out automatically with the value from the list/combo -

about the input field i did not get to it yet -



so far what happens is this: i select an option from the list/combo and all cells below get filled out automatically - good! - but when i click on the list/combo in the 2nd row on the same column (remember i have the same type of list/combo's) in each cell below the master the sub-header - thats why i call them master and slaves - basically each column has master list/combo and bunch of slave list/combos -

so - the master send the value to all his slaves to match what master says - but 1 slave from the 2nd row all of a suddent acts the same as the master and chnging his options chnges all options in all other slaves in the same column -

which made me mad - cause the 2nd row in the header is treated the same as 2nd row in the grid - both act as masters - which is wrong -

im pulling my last hair to figure out how to make the grid to understand that 2nd row in the header (aka sub-header) is NOT the same as 2nd row in the grid!!!!

what and how should i kick it to do what i am asking your grid to do -


pls - alex - help! its your baby! pls tell me what should i do with it - so it knows that subheader is not the second row of the grid???!!!
c_figer
November 17,
Sorry, I still don't understand what you are trying to achieve. I added a combo boxes to the previous examples. If you select the item from the header combo and validate it with 'enter' key - the text is copied to all cells in this column. Is this what you are trying to make or I am on the wrong path?

var myItems = ['Item1', 'Item2', 'Item3'];

var myHeaders = [
    ['Header 1', 'Header 2', 'Header 3'],
    [], //empty
    [] //empty
];

var myCells = function(col, row){return col + "." + row};

var grid = new AW.Grid.Extended;
grid.setHeaderCount(3);
grid.setHeaderText(myHeaders);
grid.setCellText(myCells);

grid.setColumnCount(10);
grid.setRowCount(1000);
grid.setCellEditable(true);

function updateColumn(text, col){
    grid.setTimeout(function(){
        grid.setCellText(text, col);
        grid.getRowsTemplate().refresh();
    });
}

// sub-headers
for (var i=0; i<10; i++){
    var combo = new AW.UI.Combo;
    combo.setItemText(myItems);
    combo.setItemCount(3);
    combo.onControlValidated = updateColumn;
    grid.setHeaderTemplate(combo, i, 1);

    var input = new AW.UI.Input;
    input.onControlValidated = updateColumn;
    grid.setHeaderTemplate(input, i, 2);
}

// cell combo
var list = new AW.UI.List;
list.setItemText(myItems);
list.setItemCount(3);
grid.setPopupTemplate(list);
grid.setCellTemplate(new AW.Templates.Combo);

document.write(grid);
Alex (ActiveWidgets)
November 17,
this is pretty close - !!! -

can we just make a list/combo that you dont have to hit enter key - i mean the one in the sub - header?
c_figer
November 18,
also your example has no difference between input and combo - in my explined desihn - i have list/combo - not just comdo - where you need to type some in or select from list - no -i only allow selections to be made - without allowing to type into combo - thats why i use list/combo just like a regular drop down list - if this is possible in your example - i'd be happy like a goose escaped a hunter!!!! :)
c_figer
November 18,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.