"Show entries" select doesnt work (doesn't show)
"Show entries" select doesnt work (doesn't show)
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]
} );
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]
} );
This discussion has been closed.
Replies
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
Idiots guide available? :-)
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
Allan