Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSP
jsp forEach, jquery to fetch values of selected row
joy b chakravarty
Ranch Hand
Posts: 62
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have a forEach loop , and I want to get the values(column values) of the selected row.
<c:forEach var="searchResult" items="${searchResults.results}" varStatus="rowCounter"> <tr class="tableContentNoHandTr" id="trAccountSearch${valSeparator}${searchResult.account}"> <td class="tableContentTd" align="center" title="Used only for deleting"> <input type='checkbox' id='chkCheckUncheck${valSeparator}${searchResult.account}'> </td> <td class="tableContentTd"><c:out value="${searchResult.account}"/></td> <td class="tableContentTd"><c:out value="${searchResult.aa}"/></td> <td class="tableContentTd"><c:out value="${searchResult.bb}"/></td> <td class="tableContentTd"><c:out value="${searchResult.cc}"/></td> <td class="tableContentTd"><c:out value="${searchResult.dd}"/></td> <td><input type="hidden" id='rowCount${searchResult.account}' value="${rowCounter.count}"></input></td> </tr> </c:forEach> //this is invoked when a row is selected $('#accountSearchResultsRowsTbody tr').click(function() { try { selectedAccount = $(this)[0].id; selectedAccount = selectedAccount.substr( selectedAccount.indexOf('trAccountSearch${valSeparator}') + 'trAccountSearch${valSeparator}'.length); //so far so good, i get the value of selectedAccount //I now want to get the values of aa, bb, cc and dd for the selected row, not sure how to do it var rowCnt = $( "#rowCount" + selectedAccount).val(); alert("rowCnt : " +rowCnt); var aa = ${searchResults.results[rowCnt].aa}; var bb= ${searchResults.results[rowCnt].bb}; } catch(ex) { alert('JS error in searchResultSelected(): ' + ex.message); } });
Please help, thanks in advance
Cheers, Joy [SCJP 1.4, SCBCD 5.0]
get high on alcohol, algorithm or both
joy b chakravarty
Ranch Hand
Posts: 62
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
well i got the answer,
//this is invoked when a row is selected $('#accountSearchResultsRowsTbody tr').click(function() { try { selectedAccount = $(this)[0].id; selectedAccount = selectedAccount.substr( selectedAccount.indexOf('trAccountSearch${valSeparator}') + 'trAccountSearch${valSeparator}'.length); //so far so good, i get the value of selectedAccount //And now i know how to get the values var account = $(this).find("td").eq(1).html(); var aa= $(this).find("td").eq(2).html(); var bb= $(this).find("td").eq(3).html(); } catch(ex) { alert('JS error in searchResultSelected(): ' + ex.message); } });
Cheers, Joy [SCJP 1.4, SCBCD 5.0]
get high on alcohol, algorithm or both
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Extracting a parameter from c:out value
Jstl not reflecting values back to servlet
How to update a image using servlet?
Help needed with jquery and input text
Passing row id from html table on jsp to Action Class in Struts
More...