Wizzud wrote:
$('table') ... gets all tables
$('table').eq(1) ... gets the second table
$('#formelement').parent().parent().parent() ... gets the 'great-grandad' of
#formelement
or, to look back up the DOM for a table ...
var _find = $('#formelement');
while(!_find.is('table')){ _find =
$('table') ... gets all tables
$('table').eq(1) ... gets the second table
$('#formelement').parent().parent().parent() ... gets the 'great-grandad' of
#formelement
or, to look back up the DOM for a table ...
var _find = $('#formelement');
while(!_find.is('table')){ _find = _find.parent(); }
Klaus Hartl wrote:
$('#formelement').parents('table:eq(0)');
Even simpler.
NOTE: In documentation of parents(), first example is misleading/incorrect
in that shows the returned items in reverse order.
--
View this message in context:
Some simple plugins that may help.
(function($) {
$.fn.moveRowAfter = function(index, afterIndex)
{
this.find(tr).eq(index).insertAfter(this.find(tr).eq(afterIndex));
return this;
};
$.fn.moveRowBefore = function(index, beforeIndex)
{
Sam...what plugins are you refering to with the moveRowAfter?
M
On Aug 2, 2:24 am, Wizzud [EMAIL PROTECTED] wrote:
$('table') ... gets all tables
$('table').eq(1) ... gets the second table
$('#formelement').parent().parent().parent() ... gets the 'great-grandad' of
#formelement
or, to
Ok...so this is working somewhat...the issue I see now is that the
find() in the plugins are finding the wrong row.
My table structure looks like this:
table
- row1
- cell 1
-table
row 2
-cell 1
-table
row3
-cell 1
-table
When we use the
Mike Miller wrote:
Ok...so this is working somewhat...the issue I see now is that the
find() in the plugins are finding the wrong row.
My table structure looks like this:
table
- row1
- cell 1
-table
row 2
-cell 1
-table
row3
-cell 1
-table
When
Klaus Hartl wrote:
Mike Miller wrote:
Ok...so this is working somewhat...the issue I see now is that the
find() in the plugins are finding the wrong row.
My table structure looks like this:
table
- row1
- cell 1
-table
row 2
-cell 1
-table
row3
-cell 1
ok Klaus,
Thanks for this...it truly is amazing what jquery can do. A quick
question for you though regarding the index property. If I want to
make this more dynamic...do you know how I would find out the value of
the rowIndex property for the table row I want to move?
On Aug 2, 1:17 pm,
Mike Miller wrote:
Thanks for this...it truly is amazing what jquery can do. A quick
question for you though regarding the index property. If I want to
make this more dynamic...do you know how I would find out the value of
the rowIndex property for the table row I want to move?
Get it
Here is my snippet:
var myIndex = $j(#show_medication).parents(tr)...
#show_medication is a form element.
parents(tr) is the row containing the element
Now I want to get the rowIndex
Once I have the rowIndex property I would call the moveRow function as
follows:
Mike Miller wrote:
Here is my snippet:
var myIndex = $j(#show_medication).parents(tr)...
#show_medication is a form element.
parents(tr) is the row containing the element
Now I want to get the rowIndex
Once I have the rowIndex property I would call the moveRow function as
follows:
Hi,
Thanks for the tip...the one other question I have related to this
that I need to move these rows in a table that has no id. The table
does have form elements that have id's and I could do something like
this in JS
document.getElementById(formelement).parentNode.parentNode.parentNode
-
Or for more detailed movement:
$('tr:eq(3)').insertBefore('tr:eq(1)');
or
$('tr:eq(2)').insertAfter('tr:eq(5)');
Note: the numbers are the row count - beginning at 0 (zero) for the
first row.
Lookup the jquery :xxx qualifiers for more options.
On Jul 31, 4:16 am, Mike Miller [EMAIL
Mike Miller wrote:
Haven't been able to find any documentation so far that talks about
how to move rows around with jquery. Don't really need to sort the
whole table...rather I want to move one row to another position. Can
this be done?
The following should work as long as I'm not missing
15 matches
Mail list logo