Placement of In-line editing feature within datatable
Placement of In-line editing feature within datatable
VermontBound
Posts: 7Questions: 0Answers: 0
Hi,
I am following the inline editing blog for one of our requirements:
http://datatables.net/blog/Inline_editing
This works great, thanks. The only caveat is that we need the inline editor to always be on the top
of the datatable. Right now, it seems to always be on the bottom, which is not even viewable by the
user unless he does a reverse sort.
My questions:
1) How do I control whether the inline editing bar appears on the very top or very bottom?
2) How do I force the inline editing bar to **always** be on the very top of the datatable **no matter what**.
I ask this second one becasue somebody may be adding a new row in a filtered view (where the very top
or very bottom of the total records is not available).
I appreciate your responses, thanks!
I am following the inline editing blog for one of our requirements:
http://datatables.net/blog/Inline_editing
This works great, thanks. The only caveat is that we need the inline editor to always be on the top
of the datatable. Right now, it seems to always be on the bottom, which is not even viewable by the
user unless he does a reverse sort.
My questions:
1) How do I control whether the inline editing bar appears on the very top or very bottom?
2) How do I force the inline editing bar to **always** be on the very top of the datatable **no matter what**.
I ask this second one becasue somebody may be adding a new row in a filtered view (where the very top
or very bottom of the total records is not available).
I appreciate your responses, thanks!
This discussion has been closed.
Replies
You might be interested in the more complete editing solution for DataTables, Editor: http://editor.datatables.net , which does have everything needed for editing, unlike the blog post.
Allan
Yes, I didn't clarify very well. The editing elements are, indeed, put into the table, but at the top of the rows - the first item at the top. How would I get the script to insert the editing elements at the other end (the bottom) of the table?
Thanks a bundle for your response.
Peter
Allan
Ah, I see the confusion. OK, again, sorry for the lack of clarity.
I am talking about adding "new rows" using inline editing, not editing current rows.
Similar to the link I posted in the original question:
http://datatables.net/blog/Inline_editing
If you click on the "Add new row" link, an empty inline row gets added to
the top row of the table. I want the same behavior, but I want to be able
to add to the bottom row of the table (and limit the ability to add new rows
to one time per submit, but I may be able to figure this one out).
I hope I have done a better job of explaining?
[code]
$('#new').click( function (e) {
e.preventDefault();
var aiNew = oTable.fnAddData( [ '', '', '', '', '',
'Edit', 'Delete' ] );
var nRow = oTable.fnGetNodes( aiNew[0] );
editRow( oTable, nRow );
nEditing = nRow;
} );
[/code]
So you need to alter the fnAddData to have it insert the new row wherever it is that you want it to appear in the table. That is determined solely by sorting. So if you want it at the end, you need to change it so that it will be sorted to appear at the end of the table.
Allan