select search
select search
Link to test case: http://live.datatables.net/cehojibu/1/edit
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Hi,
I am trying to do the following inside the header
1) Input search
2) Select search
and facing the following two difficulties and unable to solve self
1) Select search shows the last column values on each column
2) There is one extra header row as well.
Any kind help from anybody ?
princy.
Replies
I'm not seeing the select inputs in your test case. Please update the test case to show the issue or see if this example from this thread helps you.
Kevin
Hi,
From your reply
"I'm not seeing the select inputs in your test case."
After trying so many possibilities forget the original to update.
"or see if this example from this thread helps you."
Unable to sort out the unwanted stuffs.
"update the test case to show the issue"
and facing the following two difficulties and unable to solve self
1) Select search shows the last column values on each column
2) There is one extra header row as well.
Any kind help from anybody ?
princy.
I removed the extra code:
http://live.datatables.net/zoxujusi/6/edit
I'm still not seeing the select header or the extra header rows in your test case, so I updated it with a second header in the HTML and made some changes which make it look the same as the exampleI linked to:
http://live.datatables.net/cehojibu/5/edit
You have:
This will apply to all
th
in the row. You need to also use.eq(column.index())
to narrow down to the specific column, for example:Guessing you are also starting with two header rows defined in your HTML you also need to clone only one header, as I mentioned in the other thread, with
:eq(0
, like this:Also use
orderCellsTop
to move the sorting functions to the top row, away from the search inputs.Kevin
Hi,
One more thing
Is it possible to sort like for example
select the value / data say Javascript Developer from column position then in columns named office and age pops only the content related to Javascript Developer ?
http://live.datatables.net/cehojibu/6/edit
I don't know whether it is possible or not
This example from another thread shows how to have cascading select lists.
Kevin
Hi,
I tried within my limited knowledge and is available at
http://live.datatables.net/meqorere/1/edit
But now the problem is both the searches the default and the created at header thead tr:eq(2) also not working.
Any kind help ?
You have this:
That turns off searching for those columns. The example uses that to filter the columns to apply the select search. Instead you can use a class name to define the columns for the select search. See this updated example:
http://live.datatables.net/kovukuhe/1/edit
Kevin
Hi,
I made the final attempt to use a button to clear the both input and select searches at
http://live.datatables.net/kovukuhe/2/edit
The button is placed at
<body>
<div class="container">
and the code is at the bottom of js
$('#table-search').on('click', function(e){
$('.selectSearch').val('').change(); // reset the value to empty
$("select").selectOptions("");
$('#example').DataTable();
table
.search( '' )
.columns().search( '' )
.draw();
});
but nothing function to clear the both input and select searches
Any kind help ?
Start by looking for errors in the browser's console. You are getting this error:
I'm not sure what
selectOptions
is. Commenting out this line results in this error:Its a Javascript scoping issue. Move the event handler inside the document.ready() function.
Now the search is being reset but the select element is not cleared. The class
selectSearch
is thetd
not theselect
element. You need to change your selector to find theselect
element, for example:Updated example:
http://live.datatables.net/kovukuhe/3/edit
Kevin
Hi,
I just add a line
$("input:text").val("")
will clear all the textbox value
at
http://live.datatables.net/kovukuhe/4/edit
Now working well.
Again i add both select and search to the footer at
http://live.datatables.net/kovukuhe/5/edit
now the problem is
1)
the select search needs to appear on 2nd row of the footer
but with the lack of knowledge i am unable to do so
and as per the current script it appears on the 1st row.
2)
also i need the select search only to the same column as header like 2,3,and 4.
Any kind help ?
Change that to be
Change
columns()
to becolumns([2,3,4])
to limit it.See updated example here: http://live.datatables.net/kovukuhe/6/edit
Colin
Hi,
I made the sorting on the footer as well here at
http://live.datatables.net/kovukuhe/7/edit
But don't know how to make the select search at footer also cascading like the header.
Any kind help ?
Hi,
http://live.datatables.net/kovukuhe/7/edit
Any kind help ?
Other forum members may wish to help, but it's beyond the scope of the support we offer as it'll take time to understand/resolve. We do provide professional support services, the options are listed here. Hope that helps,
Colin