Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
566 views
in Technique[技术] by (71.8m points)

Rails, how to display jquery-ui-datepicker calender on specific page?

I have already jquery-ui-rails (5.0.5) version and displayed calender as below,

enter image description here

this calender is displayed in all pages,

i need to display different calender as below,

enter image description here

on specific page.

    $("#new_calender").datepicker({
    changeMonth: true,
    changeYear: true,
    format: 'yyyy/mm/dd',
    language: "en",
    orientation: "bottom auto",
    todayHighlight: true,
    toggleActive: true,
    autoclose: true
    });

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Ensure that the jQuery UI datepicker localization files available at https://github.com/jquery/jquery-ui/tree/master/ui/i18n are included. They may already be inculded by the jquery-ui-rails gem so check that too.

You can override an individual datepicker for a specific locale:

$("#new_calender").datepicker( $.datepicker.regional[ "ja" ] );

Do this after intializing the datepicker, I dont see a language option in the jQuery UI options for datepicker so dont think thats the right way.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...