3.2.0

Grid problem: can't select rows with the mouse

Hi!

I've got a problem with highlighting a row by clicking on it. When I use the following code to enter my data from a database into the grid, it works:

var myData = [
      ['data from database'],
               ['data from database'],
               etc.
             ],



When I use the following code, I can't highlight a row by clicking on it! I have to use the keyboard instead:

var myData = []; 
    
             myData['rowID']= [
               ['data from database']



This is the rest of my code:

//	create ActiveWidgets Grid javascript object
    var grid = new AW.UI.Grid;
    grid.setStyle('width','99.5%')
    grid.setStyle('height','350px')
    grid.setVirtualMode(false); 

    //	provide cells and headers text
    grid.setCellText(myData);
    grid.setHeaderText(myColumns);
    
    //	yes... this line is correct
    grid.setRowIndices([<%=rowlist%>]); 
        
    //	define data formats
    var str = new AW.Formats.String;
    var num = new AW.Formats.Number;
    var dat = new AW.Formats.Date;
    
    dat.setTextFormat("dd-mm-yyyy")

    grid.setCellFormat([str, str, str, str, dat, dat, str, str, str, str]);	
    
    //	set number of rows/columns (rowcount from database)
    grid.setColumnCount(10);
    grid.setRowCount(<%=i%>);

    //	set headers width/height
    grid.setHeaderHeight(20);
    
    //  set editable on/off
    grid.setCellEditable(false);
    
    //	enable row selectors
     grid.setSelectorVisible(true);
     grid.setSelectorWidth(30);
     grid.setSelectorText(function(i){return this.getRowPosition(i)+1});
    
    //	set row selection
     grid.setSelectionMode("single-row");


    document.write(grid);


            //	on click open record
    grid.onSelectedRowsChanged = function(row){
        nr = grid.getCellValue(1,row)
        ajax_details(nr)
        tabs.setSelectedItems([0]);
    }

    //	NOTE THAT THIS ALSO DOESN'T WORK!!
    grid.onControlClicked =  function(event, row){
        alert('test');
    }
Laurens
February 3,
I found the problem, although I haven't a solution yet. The problem is that the rowID is not a number. Most of the times it is a string like: '95/015' or '94/O/111'. I need to maintain these rowID's, because I use a filter based on AJAX: I type a criterium, the request is send to an .asp page, the .asp page returns the unique record numbers that match the criterium. These unique numbers are the same as I set as rowID and are used to display the matching records with the obj.setRowIndices('...') command.

The filtering works great, but now I want to be able to select rows with my mouse! How to do this?
Laurens
February 3,

This topic is archived.

See also:


Back to support forum