Bonjour,

Je n'arrive pas à configurer le datepicker. Pourtant dans mon fichier jquery.ui.datepicker.js, j'ai :

function Datepicker() {
    this.debug = false; // Change this to true to start debugging
    this._curInst = null; // The current instance in use
    this._keyEvent = false; // If the last event was a key event
    this._disabledInputs = ]; // List of date picker inputs that have been disabled
    this._datepickerShowing = false; // True if the popup picker is showing , false if not
    this._inDialog = false; // True if showing within a "dialog", false if not
    this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
    this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
    this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
    this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
    this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
    this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
    this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
    this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
    this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
    this.regional = ]; // Available regional settings, indexed by language code
    this.regional'fr'] = { // Default regional settings
        closeText: 'fermer', // Display text for close link
        prevText: 'Précédent', // Display text for previous month link
        nextText: 'Suivant', // Display text for next month link
        currentText: 'Aujourd\'hui', // Display text for current month link
        monthNames: 'Janvier','Février','Mars','Avril','Mai','Juin',
        'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], // Names of months for drop-down and formatting
        monthNamesShort: 'Janv.','Févr.','Mars','Avril','Mai','Juin',
        'Juil.','Août','Sept.','Oct.','Nov.','Déc.'], // For formatting
        dayNames: 'Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], // For formatting
        dayNamesShort: 'Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'], // For formatting
        dayNamesMin: 'D','L','M','M','J','V','S'], // Column headings for days starting at Sunday
        weekHeader: 'Sem.', // Column header for week of the year
        dateFormat: 'dd/mm/yy', // See format options on parseDate
        firstDay: 1, // The first day of the week, Sun = 0, Mon = 1, ...
        isRTL: false, // True if right-to-left language, false if left-to-right
        showMonthAfterYear: false, // True if the year select precedes month, false for month then year
        yearSuffix: '' // Additional text to append to the year in the month headers 
};        
    this._defaults = { // Global defaults for all the date picker instances
        showOn: 'focus', // 'focus' for popup on focus,
            // 'button' for trigger button, or 'both' for either
        showAnim: 'show', // Name of jQuery animation for popup
        showOptions: {}, // Options for enhanced animations
        defaultDate: null, // Used when field is blank: actual date,
            // +/-number for offset from today, null for today
        appendText: '', // Display text following the input box, e.g. showing the format
        buttonText: '...', // Text for trigger button
        buttonImage: '', // URL for trigger button image
        buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
        hideIfNoPrevNext: false, // True to hide next/previous month links
            // if not applicable, false to just disable them
        navigationAsDateFormat: true, // True if date formatting applied to prev/today/next links
        gotoCurrent: false, // True if today link goes back to current selection instead
        changeMonth: true, // True if month can be selected directly, false if only prev/next
        changeYear: true, // True if year can be selected directly, false if only prev/next
        yearRange: 'c-10:c+10', // Range of years to display in drop-down,
            // either relative to today's year (-nn:+nn), relative to currently displayed year
            // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
        showOtherMonths: true, // True to show dates in other months, false to leave blank
        selectOtherMonths: true, // True to allow selection of dates in other months, false for unselectable
        showWeek: false, // True to show week of the year, false to not show it
        calculateWeek: this.iso8601Week, // How to calculate the week of the year,
            // takes a Date and returns the number of the week for it
        shortYearCutoff: '+10', // Short year values < this are in the current century,
            // > this are in the previous century,
            // string value starting with '+' for current year + value
        minDate: null, // The earliest selectable date, or null for no limit
        maxDate: null, // The latest selectable date, or null for no limit
        duration: '_default', // Duration of display/closure
        beforeShowDay: null, // Function that takes a date and returns an array with
            // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
            // [2] = cell title (optional), e.g. $.datepicker.noWeekends
        beforeShow: null, // Function that takes an input field and
            // returns a set of custom settings for the date picker
        onSelect: null, // Define a callback function when a date is selected
        onChangeMonthYear: null, // Define a callback function when the month or year is changed
        onClose: null, // Define a callback function when the datepicker is closed
        numberOfMonths: 1, // Number of months to show at a time
        showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
        stepMonths: 1, // Number of months to step back/forward
        stepBigMonths: 12, // Number of months to step back/forward for the big links
        altField: '', // Selector for an alternate field to store selected dates into
        altFormat: '', // The date format to use for the alternate field
        constrainInput: true, // The input is constrained by the current date format
        showButtonPanel: false, // True to show button panel, false to not show it
        autoSize: false // True to size the input for the date format, false to leave as is
    };
    $.extend(this._defaults, this.regional'fr']);
    this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');
}

Sur ma page le datepicker apparaît bien, marche, mais il est toujours en anglais et les fonctions de choix de mois et d'année ne fonctionnent pas, et n'apparaissent pas d'ailleurs. J'ai vidé le cache de mon navigateur et de cake, je ne sais plus quoi faire d'autre. Une idée ?

Merci d'avance !

3 réponses


nittya
Auteur
Réponse acceptée

Mon soucis est réglé !
Il m'a suffit de changer dans le main.js

$('.datepicker').datepicker()

$( ".datepicker" ).datepicker({
      changeMonth: true,
      changeYear: true,
      dayNames: "Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi" ],
      dayNamesMin: "Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa" ],
      dayNamesShort: "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" ],
      gotoCurrent: true,
      monthNames: "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Decembre" ],
      monthNamesShort: "Jan", "Fev", "Mar", "Avr", "Mai", "Juin", "Juil", "Aoû", "Sep", "Oct", "Nov", "Dec" ],
      prevText: "Préc",
      nextText: "Suiv",
      yearRange: "1940:2013"
    });

Salut,

Comment est-ce que tu as fait pour faire fonctionner Datepicker.
Moi j'ai un template d'admin full responsive (acheté sur un site), dans lequel est inclus le Datepicker, mais celui-ci ne veut rien entendre.
Lorsque je tente de faire apparaître le calendrier, et bien rien du tout ne s'affiche !!!
Y a-t'il quelque chose en renseigner quelques part afin de le faire fonctionner?

Merci pour ton aide

Fabien

nittya
Auteur

Excuse moi d'avoir mit du temps à répondre.
Il faut mettre dans ton fichier js principal

$('.datepicker').datepicker()

Pour l'appeler
et sur ton input l'id datepicker.

Sinon quelqu'un a une idée pour mon soucis ?