Display Length Selection alters all select HTML entities

Display Length Selection alters all select HTML entities

キツネキツネ Posts: 7Questions: 0Answers: 0
edited May 2013 in Bug reports
While working on customising a page powered by DataTables 1.9.4 I stumbled upon an amusing bug in its logic. When you select a display length (indicated as Show # entities by default), DataTables will actually edit ALL select entities in the document to the value you selected. In my instance, I have five other select HTML entities, one of which has over 100 elements whose values are numeric. When setting Display Length from 500 to 100, I noticed my combo box would suddenly jump to the item that corresponds to value 100.

In addition to this report I am submitting a fix to this problem. The correction I devised revises the jQuery statements to uniquely select the Display Length select element only, and not all of the select elements in the document.

Original code from dataTables-1.9.4.js:
* Generate the node required for user display length changing
* @param {object} oSettings dataTables settings object
* @returns {node} Display length feature node
* @memberof DataTable#oApi
function _fnFeatureHtmlLength ( oSettings )
if ( oSettings.oScroll.bInfinite )
return null;

/* This can be overruled by not using the _MENU_ var/macro in the language variable */
var sName = 'name="'+oSettings.sTableId+'_length"';
var sStdMenu = '';
var i, iLen;
var aLengthMenu = oSettings.aLengthMenu;

if ( aLengthMenu.length == 2 && typeof aLengthMenu[0] === 'object' &&
typeof aLengthMenu[1] === 'object' )
for ( i=0, iLen=aLengthMenu[0].length ; i


  • キツネキツネ Posts: 7Questions: 0Answers: 0
    Please disregard the anchor tags near the top of the function; they must have been inserted by the syntax highlighting tool upon submission of this report.
  • キツネキツネ Posts: 7Questions: 0Answers: 0
    Is development on this plugin halted or what? I see the "nightly" hasn't been updated in nearly a full year! I'm curious if we're going to see any releases after 1.9.4 or not. Also this patch has never even been acknowledged which is not a good sign.
This discussion has been closed.