mardi 23 juin 2015

Get content of cells on same row

I have an issue very similar to what was asked on enter link description here, but the syntax is a little different. I'm pretty sure it's a minor tweak but have spent too much time trying. Any help would be appreciated.

I am trying to pass the contents of selected row cells from a Telerik GV. The "path" variable is passed through a partial view, I cannot use "this" as it is not run directly from a click event. My issue is the var t3 returns the concatenated contents of ALL the rows contents for that column : "Test Deschi ho hi whatevah". How can I modify this to only give me the cell contents of the row with the matching span id? Thank you in advance.

<tr>
 <td><input id="..." value="Accounting-Payroll" type="checkbox"></td>
 <td><span id="Accounting-Payroll_span">Accounting-Payroll</span></td>
 <td></td>
 <td>Test Desc</td>
</tr>
<tr>
 <td><input value="Advertising and Marketing" type="checkbox"></td>
 <td><span id="Advertising and Marketing_span">Advertising and Marketing</span></td>
 <td></td>
 <td></td>
</tr>
<tr>
 <td><input id="..." value="TestAccessFile600.pdf" type="checkbox"></td>
 <td><span id="TestAccessFile600.pdf_span" style="padding-left: 2px;"> TestAccessFile600.pdf</span></td>
 <td>Title for test access file yada</td>
 <td>hi ho hi whatevah</td>
</tr>

    var path='TestAccessFile600.pdf';

    function EditFile(path) {
    var trw = $("td").filter(function () {
        return  $('span#' + path + '_span')}).closest("tr");
    var t3 = trw.find('td:eq(3)').text();
    ...
}

Aucun commentaire:

Enregistrer un commentaire