:: Forum >>

2 grids interacting with each other


I have one grid full of data on which I have an action that gets the selected rows data. (TABLE1)

I have another table which is blank. (TABLE2)

When the you click on a row of TABLE1, I want it to be put into TABLE2.

Any insight/help would be appreciated.

Jean - Charles
Tuesday, August 10, 2004

TABLE2 should be using some JS_ARRAY to populate data, if yes, then

1. you need to push the data in that array
2. set data/count
3. set row/values (you need to do this, if because values is intialized for zero rows)
4. call refresh

// assuming...
var myData2 = [];
obj2.getDataText = function(i, j){return myData2[i][j]};

myData2[0] = aRow;
obj2.setDataProperty("count", 1);
Sudhaker Raj
Tuesday, August 10, 2004

Most helpfull :P
Wednesday, August 11, 2004
Actaully not helpfull, I was just being polite :/

How do I use this ? In a function ? What is 'aRow' ?

Heres my code:
#Css/js declared etc.

var myColumns = ["contact", "cellno"];
        var myData = [ ["David", "0841234234"],["Bobby", "0832443534"],
            ["Uncle Sam", "0742342344"],["Aunt Sally", "0735647589"],
            ["Stuart", "0731822766"],["David Beckham", "0731231234"],
            ["Bobbi Skinstad", "0731222726"],["asdasd", "0832233445"],
            ["another num", "0832706668"],["chop", "0731244578"],
        var myData3 = [
            ["Suckass", "0841234234"],["Narf", "0832443534"],
            ["Biteme", "0742342344"],["Shampoodle", "0735647589"],
            ["Stuart", "0731822766"],["Oli fis", "0731231234"],
            ["Naatjie", "0731222726"],["lololo", "0832233445"],
            ["Zomp", "0832706668"],["Afrtoz", "0731244578"],

        var myData2 = [];

var obj = new Active.Controls.Grid;

obj.setProperty("selection/multiple", true);
obj.setDataText(function(i, j){return myData[i][j]});
obj.setColumnText(function(i){return myColumns[i]});

        //Print selected row
        function printRowData(src){
            var index = src.getProperty("row/index");
            obj2.setProperty("data/text", myData[index]);

        //Add a row
        function addRow(){
            var rowData = ["NEW-USER", "0742456431"]
            obj.setRowProperty("count", myData.length);

        //Remove a row
        function removeRow(grid) {
            var index = grid.getProperty("selection/index");
            if(index != '-1') {
                if (confirm("Are you sure you want to delete?")) {
                    _removeRow(grid, index);
                    var lastRow = grid.getProperty("row/count");
                    if(lastRow == 0) addNewRow(grid);
                        grid.setProperty("selection/index", lastRow-1);
            } else alert('Error or something.');

        function argh() {
            obj2.getDataText = function(i, j){return myData2[i][j]};
            myData2[0] = aRow;
            obj2.setDataProperty("count", 1);

        obj.setAction("click", argh);

Wednesday, August 11, 2004
Table no 2..
        var obj2 = new Active.Controls.Grid;
        obj2.setProperty("selection/multiple", true);
        obj2.setDataText(function(i, j){return myData2[i][j]});
        obj2.setColumnText(function(i){return myColumns[i]});
        obj2.setAction("click", removeRow);
JC Again
Wednesday, August 11, 2004
Hi JC,
I have pasted the code whatever you have given.But I am getting aRow undefined.Can u please send a working copy.

Friday, July 22, 2005

This topic is archived.

Back to support forum

Forum search