Editor.add() pushes the element to the head instead of appends to the end
Editor.add() pushes the element to the head instead of appends to the end

This makes the order of the fields reversed.
[code]
var editor = new $.fn.dataTable.Editor({
table: '#example'
});
for (var i = 0; i<json.tb_titles.length; i++){
var predecessor = (i == 0) ? null : json.tb_titles[i-1];
editor.add({
label: json.tb_titles[i],
name: json.tb_field_names[i]
},predecessor);
}
[/code]
This discussion has been closed.
Replies
Could you send me the contents of your
json
object so I can attempt to recreate this please?Thanks,
Allan
The json object:
I have to do bellow to fix:
Hi,
Sorry for the long delay in getting back to you about this. The problem is in how the
predecessor
variable is being set - it should be usingjson.tb_field_names
. As theadd()
documentation notes it is thefield.name
that should be given as the predecessor.allows it to work as expected.
Allan
Yes sir, I realized that as well. thank you very much.