HTML Table Filter Script + sortable table: Always show tfoot and thead
-
21-06-2021 - |
Pergunta
I use this wonderful script to make my table sortable and add some filters to it. My problem is, I need always to see the second row in the thead (that with the checkbox) . I avoided sorting the row when clicked (by making it td instead th although it's in the thead). So the main problem is that i need to see the checkbox(thead/td and it shouldn't be active(when clicked to sort the table as the row above)) and also always see the tfoot - wich is also hided when add filter... Here are my settings
var Props = {
popup_filters: true,
mark_active_columns: true,
sort: true,
sort_config: {
sort_types:['EU','EU','EU','EU','EU','EU','EU','EU','EU','EU','EU','EU','EU','EU']
},
loader: true,
loader_html: '<img src="/images/load.gif" style="vertical-align:middle; margin:0 5px 0 5px"><span>Зареждане...</span>',
mark_active_columns: true,
col_0: "select",
col_1: "multiple",
col_2: "select",
col_3: "select",
cEUtom_slc_options: {
cols:[1],
texts: [['0- 50','60 - 80','80 - 100']],
values: [
['<=50','>60 && <=80','>80 && <=100']
],
sorts: [false],
sort_config: {
sort_types:['EU','EU','EU','EU','EU','EU','EU','EU','EU','EU','EU','EU','EU','EU']
},
},
themes: {
name:['MyTheme'],
src:['TableFilter/TF_Themes/MyTheme/MyTheme.css'],
description:['My stylesheet'],
initialize:[null]
}
};
setFilterGrid("advancedtable1",Props );
Solução
I found what I needed
first what we need to do is to get the row number of the footer:
var totRowIndex = tf_Tag(tf_Id('advancedtable1'),"tr").length; //advancedtable1 is the table id
then I added this
rows_always_visible:[2,totRowIndex]
to the table props where 2 is the row in the th wich i wanted to always see and totRowIndex is the footer row.