Follow up to "Datatables defaults on datatable fields in Editor"
Follow up to "Datatables defaults on datatable fields in Editor"
As I marked the question as answered, I will follow up here...
Following this up, seems like layout is where I have my issues..
My default settings are
top: [
'buttons',
'paging',
{ search: { placeholder: 'Sökord' } }
],
topStart: null,
topEnd: null,
bottomStart: 'info',
bottomEnd: 'pageLength'
This gets overridden by
top: hasButtons
? ['search', 'buttons', 'info']
: ['search', 'info'],
bottom: ['paging'],
bottomStart: null,
bottomEnd: null,
topStart: null,
topEnd: null
It does not seem to be possible to override this in the datatable field type options.
I tried with
top: [
'buttons'
]
but to no avail.
KR,
Björn H
This question has accepted answers - jump to:
Answers
However, adding a "dom" element instead of a "layout" element such as
does override the layout removing "Search" and "Info".
/björn
"dom" is legacy. It is what I am still using. So you got a workaround now. Good to hear!
@allan sounds like there is a bug in "layout"?!
It should be working okay.
It is worth highlighting that the defaults would need to be set to
nulldue to the deep merge.Allan
@allan This code:
Adds search and info elements if the buttons are added like this:
For example:
https://live.datatables.net/jacagowu/1/edit
Possibly adding info about how to deal with the
layoutoption in theconfigproperty of the-field datatablefield type would be good.Kevin
Thanks for the clarification of the problem Kevin, this is exactly what I am trying to understand.
I thought that the overrule the datatable feild type did, was on the datatable.default settings, but it seems as it is applied after the config section of the actual field itself.
Then again, if you use "dom:", then it adhears to it.
We are trying to move from "dom" to "layout" generically during the next quarter as we see it going away in DataTables 3.0 and we have a big technical depth here.
KR,
Bjørn H
Define the buttons within the layout option as Allan’s example shows. It works as expected then.
Kevin
At the moment, my feeling is that I am unlikely to remove
domfrom DataTables 3 - it is going to prove to be too much of a backwards compatibility issue for too many people.I'm with you now. Yes, that's a pain. That's due to the use of
$.extendand how it handles arrays. I'll need to have a look at changing that to shallow copy arrays. Thank you!Allan
I have accepted the answers above, but I am glad you will look at it Allan, as the solution is to add buttons in a way that prevents inheritage of definitions as far as I can understand.
I also really don't see that Allans example is working, there is still "Search" and "Info", but might be missing something here.
We will probably stick with "dom:" in datatable fields in Editor.
We try to define the button sets centrally as far as possible.
And we will still move to layout as far as possible, it is much better for us codewise
Many thanks for your efforts,
Bjørn H
That's odd. The example I linked to doesn't show a search or info for me:
Are you seeing something different?
Allan
No, sorry, my misstake, it looks great.
/Bjørn h
@allan
Since the introduction of field type "datatable" I haven't missed anything to be honest. My next challenge is AI. Not for coding, but for the extraction of uploaded documents. I want to make data entering redundant - at least for some of my use cases. Will share when I'm done.
Yep, please keep it. Wasn't all that bad