can't select multiple rows.

can't select multiple rows.

juleejulee Posts: 16Questions: 7Answers: 0

Hi there. I have the following logic: http://jsfiddle.net/3pg21y1h/1/

What I'm trying to do is the following:
i have two HTML tables, one called users and the other selected_users. "users" is a datatable. When someone selects a record from users by clicking once, as you can see from line 9, i highlight the row in "users".
The next thing I do is search through "users" to find any other row that has a matching pnumber, which is column 3 in "users".
I want to highlight any row that matches. But this logic is not working. (lines 28 - 30)
All my debug statements show that the rows are not already in the selected[] array, and therefore should be highlighted.

But it's not.
Any ideas?

Answers

  • juleejulee Posts: 16Questions: 7Answers: 0

    actually, i made a miscomment. the rows are corrected being added to the "selected[]" array, but the GUI is just not showing the rows as being highlighted.

  • juleejulee Posts: 16Questions: 7Answers: 0

    I figured it out. I changed this:

    if (($.inArray(temp, selected)) === -1) {
            alert('need to highlight:' + this.id);
            selected.push(this.id);
            alert(selected.length);
    };
    

    to this:

          if (($.inArray(this.id, selected)) === -1) {
                    $(this).toggleClass('selected');
            };
    
This discussion has been closed.