Forum

July 12th, 2025
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Column highlight
14/03/2011
19:19
Avatar
ulysses
Member
Members
Forum Posts: 3
Member Since:
14/03/2011
sp_UserOfflineSmall Offline

Is posible highlight a comlete column, when a cell is selected? I see when onCellSelect event, the row is highlight, but y need highlight a column.

I think use onCellSelect, and use de iCol attr to chage de css.

Is a good feature too, fire an event "onColSelect"

15/03/2011
00:00
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi,

I find you question intresting and inplemented the corresponding solution which you can see live here. In the demo I follow the same way as in the current version of jqGrid and allow deselect the column if one selects it twice. So the behavior is the same like with rows. If you need another behavior you can easy modify my code.

The main parts of the code is following:

var grid = $('#list'), selColumn;
grid.jqGrid({
    // … all parameters which you need
    onCellSelect: function (rowid,iCol) {
        var i, rows = this.rows, rl = rows.length, row, rowCells;

        for(i=0; i<rl; i++) {
            row = rows[i];
            if($(row).hasClass('jqgrow')) {
                rowCells = row.cells;
                if (typeof selColumn !== "undefined") {
                    $(rowCells[selColumn]).removeClass("ui-state-highlight");
                }
                if (selColumn !== iCol) {
                    $(rowCells[iCol]).addClass("ui-state-highlight");
                }
            }
        }
        selColumn = selColumn !== iCol? iCol: undefined;
    }
}); 

Best regards
Oleg

15/03/2011
13:38
Avatar
ulysses
Member
Members
Forum Posts: 3
Member Since:
14/03/2011
sp_UserOfflineSmall Offline

Thanks for you code OlegK, is a great code. I read your code and test the demo, this is de feature what i need!. Now i implement the code in my application, to continue work with jqgrid. Is posible add this featurea as an extension? and fire an event onColSelect?

Ulysses

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
14 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information