"Show entries" select doesnt work (doesn't show)

"Show entries" select doesnt work (doesn't show)

melphmelph Posts: 37Questions: 1Answers: 0
edited May 2012 in General
Hi

Apologies now for what is probably a simple error, but I can't seem to fix it.

The problem - I can't get "Show Entries" select drop down box to show with my table. This means uses are unable to select exactly how many records they wish to display on a page. I have got it working fine with the examples from this website, but when trying to make it work with Editor, it just doesnt appear. Below is a snippet of the code I use:

Any help and pointers in th right direction will be appreciated - many thanks

[code]

$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
"ajaxUrl": "php/browsers1.php",
"domTable": "#example",
"fields": [ {
"label": "Species",
"name": "species"
etc
etc
etc

]
} );

$('#example').dataTable( {
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
/* Append the grade to the default row class name */
if ( aData.rare == "1" ) // so this is looking at row 3 'rare" which returns a value of 1,2, or 3
{
$('td:eq(2)', nRow).html( '' );
}


if ( aData.rare == "2" ) // so this is looking at row 3 'rare" which returns a value of 1,2, or 3
{
$('td:eq(2)', nRow).html( '' );
}


if ( aData.rare == "3" ) // so this is looking at row 3 'rare" which returns a value of 1,2, or 3
{
$('td:eq(2)', nRow).html( '' );
}
return nRow;
},

"sDom": "Tfrtip",
"sAjaxSource": "php/browsers1.php",
"iDisplayLength": 50,

"oLanguage": {
"sLengthMenu": 'Display '+
'10'+
'100'+
'All'+
' records'
},
"aoColumns": [

{ "mDataProp": "species" },
{ "mDataProp": "Latin" },
{ "mDataProp": "rare" },
{ "mDataProp": "quantity" },
{ "mDataProp": "location" },
{ "mDataProp": "date" }
],
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
} );
[/code]


} );

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Hi,

    The "l" option isn't in the sDom you are using for the table there, so it won't render the length control. To add it back in, just add "l" to sDom where you want the length control to appear in the DOM :-).

    Allan
  • melphmelph Posts: 37Questions: 1Answers: 0
    Thanks Allan

    Idiots guide available? :-)
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Guide for sDom ? The documentation should (I hope) cover it. If it doesn't let me know what you think is lacking and I'll see if I can beef it up.

    Allan
  • melphmelph Posts: 37Questions: 1Answers: 0
    Allan

    I was more or less poking fun at my own inability to suss all this out! You have created some comprehensive guides and instructions which I need to read through - I'm sure after doing so I might just understand enough to be dangerous!!

    Thanks for your help
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Ah :-). In fairness sDom is far from obvious! I hope to improve that situation in future releases!

    Allan
This discussion has been closed.