How to exclude rows from beeing filtered?
How to exclude rows from beeing filtered?
Hi everybody
My Table looks as follows:
| subtitle 1 |
| col1 | col2 | col3 |
| subtitle 2 |
| col1 | col2 | col3 |
| col1 | col2 | col3 |
I'm using DataTable v. 1.7.6 and I need to create a filter, which allows me to exclude some specific rows from beeing filtered. In my particular case, I want to exclude my subtitle rows from beeing filtered. I could use the custom filter to achieve this, but the problem would be that the global filter is still active and would filter those rows anyway. As proposed in the documentation (http://www.datatables.net/development/filtering#global_filters), if I want to replace the global filter with my own one, I have to drop the 'f' (filtering) option from sDom. But when I do so, the integrated search-input field would not appear anymore and I would have to create my own text field, which is not what I want, since then I have to care about how to append the text nicely on top of the table and add event mechanism etc..
Is there an easy way how to achieve this?
It would be nice if prior to the filtering an exclude function is called, which directly excludes some rows of beeing filtered. It could look simillar to the custom filter function below.
[code]
$('#myTable').dataTableExt.afnExcludeFiltering.push(
function( oSettings, aData, iDataIndex ) {
return aData[0].indexOf("subtitle") >= 0; // true to exclude from filtering
}
);
[/code]
Thanks
Slash
My Table looks as follows:
| subtitle 1 |
| col1 | col2 | col3 |
| subtitle 2 |
| col1 | col2 | col3 |
| col1 | col2 | col3 |
I'm using DataTable v. 1.7.6 and I need to create a filter, which allows me to exclude some specific rows from beeing filtered. In my particular case, I want to exclude my subtitle rows from beeing filtered. I could use the custom filter to achieve this, but the problem would be that the global filter is still active and would filter those rows anyway. As proposed in the documentation (http://www.datatables.net/development/filtering#global_filters), if I want to replace the global filter with my own one, I have to drop the 'f' (filtering) option from sDom. But when I do so, the integrated search-input field would not appear anymore and I would have to create my own text field, which is not what I want, since then I have to care about how to append the text nicely on top of the table and add event mechanism etc..
Is there an easy way how to achieve this?
It would be nice if prior to the filtering an exclude function is called, which directly excludes some rows of beeing filtered. It could look simillar to the custom filter function below.
[code]
$('#myTable').dataTableExt.afnExcludeFiltering.push(
function( oSettings, aData, iDataIndex ) {
return aData[0].indexOf("subtitle") >= 0; // true to exclude from filtering
}
);
[/code]
Thanks
Slash
This discussion has been closed.
Replies
Added to the future feature list!
Allan
Zoltan