Editor.Bubble row ID
Editor.Bubble row ID
I'm trying to get the data (row ID) from the row that I am currently editing using the bubble editor and display it inside the bubble form.
$('#example').on('click', 'tbody td:not(:first-child)', function (e) {
var modifier = editor.modifier();
if(modifier){
var data = table.row(modifier).data();
editor.bubble(this,{
message: 'Hello'+data,
button: 'Update',
});
}
});
Apparently this code is not working for me. How can I simply display the row id?
Thank you
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
data
is presumably an object or and array, so you would probably usemessage: 'Hello '+data.id
(objects with anid
property)message: 'Hello '+data[0]
(arrays with id in index 0)You could use
console.log( data )
to check the structure of that data.Allan
For some reason, the IF statement is not working, so I had to eliminate it. Now, the code:
message: 'Hello '+data.id
works like a charm, but i'm receiving only the value of the column named id for the first row regardless of where I click.How can I get the the same value but for the specific row that I click? Also, the Editor.bubble only opens once. If I try to Bubble Edit another field It won't open.
What you say suggests that
modifier
might be undefined. Is that the case?Can you give me a link to the page so I can try to debug it please?
Allan
I'll be sending it via email
Ah I see the issue - thanks for the link.
The problem is that you are calling
modifier()
before editing has been activated. So there is no modifier...I believe the code should be:
Allan
Wow! Works perfectly! Thank you so much