3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 815 Views |
-
JQuery closest('tr') won't work

2 March 2012 at 11:43pm
I have a table and when I click on a row, the childrows are opened in accordeon style with JQuery.
All works fine. But the only thing is, I want the accordeon to open a the level of the row I clicked.
Therefore, the function closest() is used. But this won't work.
My childtable always opens at the button of the mastertable...I use the JQuery 1.6.4, so that can not be the problem.
-
Re: JQuery closest('tr') won't work

3 March 2012 at 7:06am
Doesn't closest() travel up the tree? If so, it wouldn't open a child table. Maybe next() would work..
Anyway - not really a SilverStripe question
-
Re: JQuery closest('tr') won't work

3 March 2012 at 9:12pm
100% SS question.
I'm playing around with the JTable in SS. Really cool thing to work with.
All works fine, but there's just one thing I can't get right :
open the child table at the height of the parent table.http://www.codeproject.com/Articles/277576/AJAX-based-CRUD-tables-using-ASP-NET-MVC-3-and-jTa
I suppose it's the SS framework and the way the page gets rendered. In ASP no problem.
-
Re: JQuery closest('tr') won't work

5 March 2012 at 1:19am
Well, you didn't say that, did you? : -) You just said you had a table (somewhere), you click a row (= tr in my book) and closest() doesn't get you that same row (tr) - which it wouldn't, when you're clicking the row itself...
I suppose you're referring to something like this (from the jTable demo's):
$img.click(function () {
$('#StudentTableContainer').jtable('openChildTable',
$img.closest('tr'),
{ ...clicking this image inside a cell should definitelyget you the encompassing tr. Still: I don't see how this is a SilverStripe issue, unless of course you are trying to use this in the backend - or using some other interfering javascript on your frontend?
| 815 Views | ||
|
Page:
1
|
Go to Top |

