Can some one help me with this please because im banging my head against a wall now 🙁
I have a table with roughly 13 columns connected to this is a Jquery context menu, where the user can right click on the table and select copy down if they do this then i need to copy the value from the selected row down to the other rows, so far i have a JQuery function which is working to an extent, but for some reason when i run this it adds a new row to the table is not what i want, all i want to do is copy the values from the row and populate the other rows without adding a new row is that possible?
heres my JQuery
$(function() {
$('#grdvHandSets>tbody>tr').contextMenu([
{
'Copy Down': function(menuItem, menu) {
var tr = $(this),
tr2 = $(this).clone(true, true).insertAfter(this)
tr.find(':input:not(.phonenumber)').each(function() {
//console.log(this.id)
tr2.find("[id='" + this.id + "']").val($(this).val())
})
tr2.find('.phonenumber').val('')
$('#grdvHandSets .gvItem').each(function(i) {
$(this).text(i + 1)
})
}}
], {
theme: 'vista'
})
})
Can some one please help me…. 🙁
Did you write this code yourself? Its making a new row because that’s what you’re telling it to do:
To get all the rows after your current one, you can use the nextAll function.
You will probably also want to rename
tr2to something more logical, likenextRows