select a year before 1996 in the calendar?

select a year before 1996 in the calendar?

zhurb21zhurb21 Posts: 12Questions: 5Answers: 0
edited February 2021 in Free community support

How can I select a year less than 1996 when choosing a date in the calendar in search builder?
It seems like this should be an easy solution, but so far I have not been able to solve this problem.
For example, in this case i can't chose the year before 1996
https://www.datatables.net/extensions/searchbuilder/examples/initialisation/date-fmt.html
How i can fix that?

P.S. sorry, i'm just a newbie here

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    The default list is kept small to ensure the picker doesn't get too big for datetime. You can modify it with opts.yearRange - see example here : http://live.datatables.net/haniyiwu/2/edit

    Colin

  • zhurb21zhurb21 Posts: 12Questions: 5Answers: 0

    Thank you for your answer.
    Is it possible to solve it without using the Editor?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Ah, sorry, I missed that you'e using SearchBuilder. That uses the same control, so you just need to tweak the defaults to suit your needs - see example here: http://live.datatables.net/rapiqaxe/1/edit

    Colin

  • zhurb21zhurb21 Posts: 12Questions: 5Answers: 0
    edited February 2021

    Can you tell me exactly where I should do this in my case? I think it can be more complex because of the date format i used.

    $(document).ready(function(){
    var table = $('#myTable').DataTable({
    'columnDefs': [
    {type: 'date', targets: [7,9,10]}
    ],
    "bFilter": true,
    dom: 'Bfitl',
    buttons: [
    {
    extend: 'searchBuilder',
    config: {
    columns: [7,9,10],
    depthLimit: 2,
    }
    }
    ],
    }
    });

  • zhurb21zhurb21 Posts: 12Questions: 5Answers: 0

    I solved this problem by overwriting the yearRange field and by downloading this extension locally.
    Thank you very much Colin for your help

This discussion has been closed.