3.2.0

obj.getSelectedRows does not return array of selected row indices

My general code section is as follows:

var myData = [my data array here];
var myColumns = [my column headers here];
var currSel = new Array();

    function gridClick(src) {	

        var index = parseInt(obj.getCurrentRow());			
    
        if (isNaN(index)) {
            return;
        }
    		
    if (mode == GRID_MODE) {
        var ticket_id = myData[index][0]; 
        visited[ticket_id]=true;
        common.loadapp(ticket_id); 
        obj.getRowTemplate(index).setStyle("font-weight","normal");
        obj.getRowTemplate(index).setStyle("font-style","italic");
        obj.getRowTemplate(index).refresh();
    } else { // QUEUE_MODE

        visited = keyList;
        currSel = obj.getSelectedRows();

        ids="";
        
        if (currSel.length>1) {
            multiSelect = true ;
        } else {
            multiSelect = false ;
        }
        for (c=0;c<currSel.length;c++) {	    	
            ticket_id = myData[currSel[c]][0];
            keyList[ticket_id] = keyList[ticket_id] ? multiSelect : true ;
            obj.getRowTemplate(currSel[c]).setStyle("font-weight","bold");
            obj.getRowTemplate(currSel[c]).refresh();
        }
        setForm();
    }
//console.log(currSel);
} 

    
   	var obj = new AW.UI.Grid;
    obj.setId("grid");

    //assign header and cell text for aw.js

    obj.setCellData(textFunction);
    obj.setCellValue(valueFunction);
    obj.setHeaderText(myColumns);

    //set number of columns/rows for aw.js	
    obj.setRowCount(myData.length);	
    obj.setColumnCount(myColumns.length);

    obj.setSelectorTemplate(new AW.Templates.CheckedItem);
    
    document.write(obj);  

    obj.onRowSelectedChanged = function(){gridClick()};


I used an alert call to see what the length of the 'currSel' array is after checking on multiple rows, and it always returns 1. The value is last selected index. What am I missing here?

Also, with the CheckedItem template, I have to click on the row, instead of the checkbox for the selection to show up. Why is that?
Sam H
May 8,

This topic is archived.

See also:


Back to support forum