3.2.0

How do we select row headers?

In the multiple selection example, rows can be selected only by clicking in the data area. Is it possible to select one or more row by clicking the row headers as well?

Michael
August 25,
Nevermind, there was a comment here: http://www.activewidgets.com/javascript.forum.4351.12/clicking-row-headers.html

The code I was looking for is as follows:

//	create ActiveWidgets Grid javascript object
    var obj = new Active.Controls.Grid;

    //	set number of rows/columns
    obj.setRowProperty("count", <%= addressCounter %>);
    
    obj.setColumnProperty("count", 6);

    //	provide cells and headers text
    obj.setDataProperty("text", function(i, j){return myData[i][j]});
    obj.setColumnProperty("text", function(i){return myColumns[i]});
    
    
    var row = new Active.Templates.Row;
    row.setEvent("onmouseover", "mouseover(this, 'active-row-highlight')");
    row.setEvent("onmouseout", "mouseout(this, 'active-row-highlight')");

    obj.setRowTemplate(row);


    //	set headers width/height
    obj.setRowHeaderWidth("28px");
    obj.setColumnHeaderHeight("20px");

 ... data population snipped ...

    // create a row selection event 
    var selectRow = function(event)	
    {
        if (event.shiftKey) {return this.action("selectRangeOfRows")} 
        if (event.ctrlKey) {return this.action("selectMultipleRows")} 
        this.action("selectRow"); 
    }; 

    // assign row selection event to left/item 
    obj.getLeftTemplate().getItemTemplate().setEvent("onclick", selectRow);
Michael
August 25,

This topic is archived.

See also:


Back to support forum