Changing "Search:" label in table header

Changing "Search:" label in table header

nirglenirgle Posts: 3Questions: 0Answers: 0
edited January 2011 in General
I have several search fields above my DataTable that allow the user to broadly filter at the SQL level. The "Search:" label beside the search bar in the DataTable itself is therefore a bit redundant, since at that point, the search field is used only to make last minute refinements to the search query to narrow down the SQL results to exactly the data searched for.

I needed to change the label from "Search:" to "Refine search:", and couldn't see any easy way to do so using the API itself. The following jQuery code can be used (assuming your table ID is 'tblOrders'):

[code]
function InitComplete(oSettings) {
$('#tblOrders_filter')
.contents()
.filter(function() { return this.nodeType == 3 })
.replaceWith('Refine search: ');
}
[/code]
There may be a more efficient way to do this, but this is one option that works.

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    oLanguage.sSearch ( http://datatables.net/usage/i18n#oLanguage.sSearch ) is the initialisation parameter which allows this string to be customised :-)

    Allan
This discussion has been closed.