Click here to Skip to main content
15,887,027 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionProgress Bar Pin
Manish K. Agarwal31-Aug-12 3:33
Manish K. Agarwal31-Aug-12 3:33 
AnswerRe: Progress Bar Pin
C-War1-Sep-12 4:50
C-War1-Sep-12 4:50 
GeneralRe: Progress Bar Pin
Manish K. Agarwal2-Sep-12 19:22
Manish K. Agarwal2-Sep-12 19:22 
AnswerRe: Progress Bar Pin
twseitex2-Sep-12 8:24
twseitex2-Sep-12 8:24 
GeneralRe: Progress Bar Pin
Manish K. Agarwal2-Sep-12 19:51
Manish K. Agarwal2-Sep-12 19:51 
GeneralRe: Progress Bar Pin
twseitex4-Sep-12 3:18
twseitex4-Sep-12 3:18 
Questionget the checkbox index or table row index with javascript Pin
osman makhtoom30-Aug-12 13:01
professionalosman makhtoom30-Aug-12 13:01 
AnswerRe: get the checkbox index or table row index with javascript Pin
enhzflep30-Aug-12 13:26
enhzflep30-Aug-12 13:26 
You should have a look at line 522 of functions.js

If you right-click a table-row with Chrome or Opera, you can then select Inspect Element.
This will open the Dev Tools console. with the table-row still selected, you can then open the Event Listeners entry in the accordian. When I did this, I saw that the code for handling mouse-clicks on table-rows was to be found on line 522 of functions.js



With that done, one can see that the function basically looks for all any child elements of the row of type 'input' it then does some logic checking before checking/unchecking the checkbox.

Here's the function for reference. (I've marked what was line 522 with *****)

JavaScript
/**
 * This array is used to remember mark status of rows in browse mode
 */
var marked_row = new Array;

/**
 * enables highlight and marking of rows in data tables
 *
 */
function PMA_markRowsInit() {
    // for every table row ...
    var rows = document.getElementsByTagName('tr');
    for ( var i = 0; i < rows.length; i++ ) {
        // ... with the class 'odd' or 'even' ...
        if ( 'odd' != rows[i].className.substr(0,3) && 'even' != rows[i].className.substr(0,4) ) {
            continue;
        }
        // ... add event listeners ...
        // ... to highlight the row on mouseover ...
        if ( navigator.appName == 'Microsoft Internet Explorer' ) {
            // but only for IE, other browsers are handled by :hover in css
            rows[i].onmouseover = function() {
                this.className += ' hover';
            }
            rows[i].onmouseout = function() {
                this.className = this.className.replace( ' hover', '' );
            }
        }
        // Do not set click events if not wanted
        if (rows[i].className.search(/noclick/) != -1) {
            continue;
        }

/******************************************************************
 The code below was line 522 - it handles the clicking on the table row
the other code is for setup/assorted functionality of the table
******************************************************************/
        // ... and to mark the row on click ...
        rows[i].onmousedown = function() {
            var unique_id;
            var checkbox;

            checkbox = this.getElementsByTagName( 'input' )[0];
            if ( checkbox && checkbox.type == 'checkbox' ) {
                unique_id = checkbox.name + checkbox.value;
            } else if ( this.id.length > 0 ) {
                unique_id = this.id;
            } else {
                return;
            }

            if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
                marked_row[unique_id] = true;
            } else {
                marked_row[unique_id] = false;
            }

            if ( marked_row[unique_id] ) {
                this.className += ' marked';
            } else {
                this.className = this.className.replace(' marked', '');
            }

            if ( checkbox && checkbox.disabled == false ) {
                checkbox.checked = marked_row[unique_id];
            }
        }

        // ... and disable label ...
        var labeltag = rows[i].getElementsByTagName('label')[0];
        if ( labeltag ) {
            labeltag.onclick = function() {
                return false;
            }
        }
        // .. and checkbox clicks
        var checkbox = rows[i].getElementsByTagName('input')[0];
        if ( checkbox ) {
            checkbox.onclick = function() {
                // opera does not recognize return false;
                this.checked = ! this.checked;
            }
        }
    }
}
window.onload=PMA_markRowsInit;

Make it work. Then do it better - Andrei Straut

GeneralRe: get the checkbox index or table row index with javascript Pin
osman makhtoom30-Aug-12 13:45
professionalosman makhtoom30-Aug-12 13:45 
GeneralRe: get the checkbox index or table row index with javascript Pin
enhzflep30-Aug-12 14:36
enhzflep30-Aug-12 14:36 
GeneralRe: get the checkbox index or table row index with javascript Pin
osman makhtoom30-Aug-12 19:51
professionalosman makhtoom30-Aug-12 19:51 
GeneralRe: get the checkbox index or table row index with javascript Pin
BobJanova30-Aug-12 22:48
BobJanova30-Aug-12 22:48 
GeneralRe: get the checkbox index or table row index with javascript Pin
enhzflep30-Aug-12 23:18
enhzflep30-Aug-12 23:18 
AnswerRe: get the checkbox index or table row index with javascript Pin
enhzflep30-Aug-12 23:24
enhzflep30-Aug-12 23:24 
GeneralRe: get the checkbox index or table row index with javascript Pin
kmoorevs28-Sep-12 6:07
kmoorevs28-Sep-12 6:07 
Questionuse JQuery in C# code Pin
GSingh-Developer29-Aug-12 7:26
GSingh-Developer29-Aug-12 7:26 
AnswerRe: use JQuery in C# code Pin
jkirkerx29-Aug-12 8:01
professionaljkirkerx29-Aug-12 8:01 
GeneralRe: use JQuery in C# code Pin
GSingh-Developer29-Aug-12 8:26
GSingh-Developer29-Aug-12 8:26 
GeneralRe: use JQuery in C# code Pin
jkirkerx29-Aug-12 9:49
professionaljkirkerx29-Aug-12 9:49 
AnswerRe: use JQuery in C# code Pin
BobJanova30-Aug-12 0:18
BobJanova30-Aug-12 0:18 
GeneralRe: use JQuery in C# code Pin
jkirkerx30-Aug-12 7:34
professionaljkirkerx30-Aug-12 7:34 
SuggestionText editor Pin
Nolee K28-Aug-12 2:57
Nolee K28-Aug-12 2:57 
GeneralRe: Text editor Pin
Pete O'Hanlon28-Aug-12 3:06
mvePete O'Hanlon28-Aug-12 3:06 
GeneralRe: Text editor Pin
BobJanova28-Aug-12 3:31
BobJanova28-Aug-12 3:31 
AnswerRe: Text editor Pin
Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)28-Aug-12 3:56
protectorTadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)28-Aug-12 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.