3.0 beta 2

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
Thursday, August 25, 2005
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
Thursday, August 25, 2005

This topic is archived.


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.