alphabetSearch Issues
alphabetSearch Issues
On a particular page of my website I have 7 tables coded within a single grid element. Six of the tables need to fill the whole grid element so the width for each is 100%. One table only has 1 column so I set the width to 50%. This works great for the table but the alphabetSearch bar is still 100%.
How do I set the alphabetSearch bar to be less than 100%.
How can I prohibit the alphabetSearch bar to not display.
More detail about #2... For all of my tables I have a global default routine that sets the layout as follows...
layout: {
top2: 'alphabetSearch',
top1: 'paging',
bottom: 'info'
},
Thus, how can I set the layout for the table in the js code so that the alphabetSearch does not display. I tried
top2: '',
top2: false, and
top2: null
but all three causes an error.
Here is a link to the test case.
I have the js code commented out so you can see the issue with problem 1.
TIA for your assistance
jdadwilson
Answers
1) With a little CSS:
2)
top2: null
should do I think. Can you update the example to demonstrate this issue please?Thanks,
Allan
I inspected the alphabetSearch
div
element and it has this CSS:I think you can override the CSS with this in the
style
section of that page:Let us know if it works.
I'm not sure where your Datatables init code is at but I suspect the problem is you are not overriding the default layout setting. In that particular Datatable you will need to override the full
layout
option, something like this:Nothing is merged between the default settings and what is in the individual Datatable init code. The Datatable. init options will override the full option in the default settings.
Kevin
It seems that the default and the local do merge. I changed the local to...
and the alphabetSearch bar still showed, and with no error.
I then added...
to the local. The alphabetSearch bar did not show but the error did.
Here is the link to the test case.
jdadwilson
Using the following...
approach would not work as that would change all of the width of all alphabetSearch bars throughout the site.
What I need is a js snippet that would only change the width as desired.
document.getElementById will not work since the div doesn't have an id just the class.
I've searched for how to change the width value of a class but didn't find anything.
jdadwilson
That maybe the case now. IIRC there was a thread awhile back discussing this and Allan may have changed something.
I might be missing something but how do I see the error? What is the error? Which table are you trying to remove the alphabetSearch bar from?
Inspecting your page the alphabetSearch bar is in the
div
with the id oftable_Links_wrapper
. Adjust the selector to find that div first then find the alphabetSearch bar. Maybe this will work:Kevin
The table comes from the 'Article Links' button to the right. The table is not displayed because of the local layout...
The error shows on the inspect -> console panel.
I really don't want to remove it, I just want the width to adjust to the width of the table.
jdadwilson
Sorry, I had to clear the browser's cache.
If you follow the traceback you will see you defaults has this, referred to on line 8 of the traceback:
Which is executing
thisApi.alphabetSearch.recalc();
in this code:Ultimately getting to line 2:
The problem is you don't have alphabetSearch enabled for this Datatable. One suggestion is to override the defaults with an empty
initComplete
for this Datatable, for example:Or possibly better is to add this if statement in
hide_alphaLetters()
to see if the container exists:Kevin