Get the data from the clicked row with inline form command
Get the data from the clicked row with inline form command
I'm trying to implement "Copy this row but allow editing of one or more fields" using inline form commands.
I need to get the data from the row the user clicked on to open the form.
this.get() gathers the data from the empty create form. I want the data from the clicked row so I can use it to populate the .Create form.
I tried the method in http://datatables.net/forums/discussion/15981/how-to-get-a-value-from-a-row-on-edit/p1
but this.s.editRow is null (probably because this isn't within an editor.edit?).
A link on each row calls the following function:
[code]
//
// "Copy" is clicked
//
$(jqDomTableID).on('click', 'a.editor_copy', function (e) {
e.preventDefault();
editor.create(
'Copy row.',
{
"label": "Create new row with this data",
"fn": function() {
var foo = this.get(); // Gets the create form's empty fields
var bar = this.s.editRow; // null
var baz = DataTableObject.fnGetData(bar); // Error because bar is null
//editor.submit();
}
}
);
});
[/code]
The ultimate goal is to populate this form, as if it were an editor.edit() form, but submit it after edits as if it were an editor.create() form so that I get a new row, not an edit to the clicked row.
I know you're enormously busy, Allan, but if you can find a few minutes to offer some advice, I'd appreciate it greatly.
I need to get the data from the row the user clicked on to open the form.
this.get() gathers the data from the empty create form. I want the data from the clicked row so I can use it to populate the .Create form.
I tried the method in http://datatables.net/forums/discussion/15981/how-to-get-a-value-from-a-row-on-edit/p1
but this.s.editRow is null (probably because this isn't within an editor.edit?).
A link on each row calls the following function:
[code]
//
// "Copy" is clicked
//
$(jqDomTableID).on('click', 'a.editor_copy', function (e) {
e.preventDefault();
editor.create(
'Copy row.',
{
"label": "Create new row with this data",
"fn": function() {
var foo = this.get(); // Gets the create form's empty fields
var bar = this.s.editRow; // null
var baz = DataTableObject.fnGetData(bar); // Error because bar is null
//editor.submit();
}
}
);
});
[/code]
The ultimate goal is to populate this form, as if it were an editor.edit() form, but submit it after edits as if it were an editor.create() form so that I get a new row, not an edit to the clicked row.
I know you're enormously busy, Allan, but if you can find a few minutes to offer some advice, I'd appreciate it greatly.
This discussion has been closed.