How to change the selected option in the view entries dropdown using the iDisplayLength attribute

How to change the selected option in the view entries dropdown using the iDisplayLength attribute

ebrenesebrenes Posts: 2Questions: 1Answers: 0

I want to show 20 entries so I change this attribute 'iDisplayLength' to 20, but the dropdown keeps showing "show 10 entries". How can I change the selected option in the view entries dropdown? using the same value in iDisplayLength.

Thanks.

Answers

  • glendersonglenderson Posts: 231Questions: 11Answers: 29

    Can you copy your table initialization routine? "iDisplayLength":20, should be the answer.

    Are you also including "20" as one of your dropdown options?

    "LengthMenu":[[10,20,50,100,-1],[10,20,50,100,""All""]], 
    "iDisplayLength":20
    
  • ebrenesebrenes Posts: 2Questions: 1Answers: 0

    I fix that issue, I'm using a custom dropdown to specify the number of rows to show in the table, so when I change the attribute "iDisplayLength":20, the original dropdown created by the dataTables changes correctly but my custom dropdown not, so I change a little bit the code in the _fnFeatureHtmlLength method, using the settings parameter I just generate the html code to my custom dropdown and append it.

    div.children().append(
    settings.oLanguage.sLengthMenu.replace( 'MENU', selectCustom )
    ).append(optionStructure);

    instead of the orignal dropdown

This discussion has been closed.