You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 2, 2025. It is now read-only.
Hi,
This bug can actually be viewed here: http://l-lin.github.io/angular-datatables/#/withColumnFilter
Notice how the input fields are empty and the "all" option in the select list is "Last Name YodaTitiKyleBarWhateveryournameis".
When the postRender function for Column Filter is first called, the input and select fields are added, using the text in the th tags as the "placeholder" text or the first "All" option (respectively). This is fine, but the problem is that postRender is called again, which alters the input and select fields, resulting in empty input fields and the weird looking value for the "All" option in a select list...
My guess is that we'll want to prevent the postRender in the initColumnFilterPlugin function from executing multiple times. A fairly naive approach might be:
function initColumnFilterPlugin(DTRendererService) {
var columnFilterPlugin = {
postRender: postRender
},
rendered = false;
DTRendererService.registerPlugin(columnFilterPlugin);
function postRender(options, result) {
if (!rendered && options && options.hasColumnFilter) {
rendered = true;
result.dataTable.columnFilter(options.columnFilterOptions);
}
}
}
This would obviously not help in cases where select lists are used and the options are filled by the values in the table (any new entries in that column wouldn't be rendered). I'm not sure if there's a better way without having to dig into the dataTables.columnFilter code as well...
I'm curious to see what thoughts others may have on this.
Thanks!
The text was updated successfully, but these errors were encountered:
I inspected the issue. As you noticed, the DataTables is rendered twice, but with a slightly different option.
For some unknown reason, the second time it renders, it adds the attribute bRegex to false for the third column (it must be the plugin columnFilter that adds it). Thus the condition in the watcher returns false and the table is rendered again.
So, I guess we need to provide every attributes for the columnFilter options.
Hi,
This bug can actually be viewed here: http://l-lin.github.io/angular-datatables/#/withColumnFilter
Notice how the input fields are empty and the "all" option in the select list is "Last Name YodaTitiKyleBarWhateveryournameis".
When the postRender function for Column Filter is first called, the input and select fields are added, using the text in the th tags as the "placeholder" text or the first "All" option (respectively). This is fine, but the problem is that postRender is called again, which alters the input and select fields, resulting in empty input fields and the weird looking value for the "All" option in a select list...
My guess is that we'll want to prevent the postRender in the initColumnFilterPlugin function from executing multiple times. A fairly naive approach might be:
This would obviously not help in cases where select lists are used and the options are filled by the values in the table (any new entries in that column wouldn't be rendered). I'm not sure if there's a better way without having to dig into the dataTables.columnFilter code as well...
I'm curious to see what thoughts others may have on this.
Thanks!
The text was updated successfully, but these errors were encountered: