Skip to content

Commit

Permalink
#617 populate the column filter fields after redrawing a table with s…
Browse files Browse the repository at this point in the history
…tate-saving and previously active filters
  • Loading branch information
stephanrauh committed Jan 15, 2017
1 parent e78bc14 commit 319c28a
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -555,16 +555,16 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce
// # Footer stuff:
// https://datatables.net/examples/api/multi_filter.html
// # Convert footer column text to input textfields
rw.writeText("\n" + widgetVar + ".find('.bf-multisearch').each(function() {" + "var title = $(this).text();"
rw.writeText(widgetVar + ".find('.bf-multisearch').each(function(){" + "var title=$(this).text();"
+ "$(this).html('<input class=\"input-sm\" type=\"text\" placeholder=\"Search ' + title + '\" />');"
+ "});\n", null);
+ "});", null);
// # Add event listeners for each multisearch input
rw.writeText("table.columns().every( function (col) {" + "var that = this;\n" + "var inputs = $("
+ widgetVar + ".find('.bf-multisearch input'));\n"
+ "$(inputs[col]).on( 'keyup change', function () {" + " if ( that.search() !== this.value ) {"
+ " that.search( this.value ).draw('page');" + " }" + "} );" +

"} );", null);
rw.writeText("table.columns().every( function(col) {" + "var that=this;var inputs=$("
+ widgetVar + ".find('.bf-multisearch input'));"
+ "inputs[col].value=table.columns(col).search()[0];"
+ "$(inputs[col]).on('keyup change', function(){if(that.search()!==this.value){"
+ "that.search(this.value).draw('page');}});" +
"});", null);
}
// # End enclosure
rw.writeText("} );", null);
Expand Down

0 comments on commit 319c28a

Please sign in to comment.