سؤال

In Allan Jardine's DataTables plugin, what's the option by which no. of rows to display in table can be altered?

I know about iDisplayLength for server-side function. I am using it successfully. When the database has sufficient rows, it shows those many rows.

But when, for example, if I set it to 10 (rows), it should display those many rows (even if there are only 3 rows in the database & the rest 7 blank rows should be displayed).

Basically I want to control the height of table, irrespective of how many records are there in the database.

هل كانت مفيدة؟

المحلول

I found out. Just set this property in table initialisation

    "sScrollY": "100px",

In place of 100px, put the size as required.

نصائح أخرى

Wel one thing you could consider doing is controlling the minHeight of the class dataTables_wrapper wich is set at 302 px by default

.dataTables_wrapper {
    clear: both;
    min-height: 302px;
    position: relative;
}

This usually is enough for everyone, but if you override the settings you could set it higher.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top