Table with the first static row and always visible

Table with the first static row and always visible

antoniog85antoniog85 Posts: 3Questions: 0Answers: 0
edited October 2010 in General
Hi,
I would like to make a table with the first row containing input field to add other rows.
I saw that there is fnAddData function, so I tried:
[code]$(document).ready(function() {
oTable = $("#tblCarichi").dataTable({
"sDom": '<"top"ip>rt<"bottom"><"clear">',
"sPaginationType": "two_button",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "?action=getElenco",
"iDisplayLength": 10,
"oLanguage": {"sUrl": "/html/plugin/datatables/language/it.txt"},
"aoColumns": [
{"bSortable": false},
{"bSortable": false},
{"bSortable": false},
{"sWidth": "30px", "bSortable": false, "bSearchable": false}
]
});

oTable.fnAddData([
'',
'',
'',
''
]);
});[/code]
but my custom row doesn't appear and there aren't errors.
How can I do?
Thanks.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Ordering in DataTables is done by sorting. So if you want your custom row to appear always at the top, you must have a sorting plug-in ( http://datatables.net/plug-ins/sorting ) which will force it to always be at the top.

    An alternative is to put the inputs into the header in a second TR row, but with TD elements, rather than TH.

    Allan
  • antoniog85antoniog85 Posts: 3Questions: 0Answers: 0
    The problem is that the script above doesn't work. In fact, I get only server side data.
    In any case, I tried your suggestion to put my custom rows in the header and it works. I didn't think at this solution!
    But if there is another solution to achieve the same purpose, I'd like to know how.
    Thank you.
This discussion has been closed.